feature request: zero-width lookahead/-behind expression in the Matcher
See original GitHub issueThe new Matcher in #1971 looks really neat! Maybe I haven’t looked closely enough, but it seems that the idea in the title isn’t part of the feature set. Say you want to find all loops in a text, but want to ignore fruit loops. You could do something like: [{'LOWER': 'fruit', 'op': '!'}, {'LEMMA': 'loop'}]
(even with the old matcher), but that returns matches including whatever word is in front of loop.
I don’t know how hard it would be to implement, but adding an extra flag, include
(possibly with a better name) could make it possible to return the match as just ‘loop’:[{'LOWER': 'fruit', 'op': '!', 'include' : False}, {'LEMMA': 'loop'}]
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Lookahead and Lookbehind Tutorial—Tips &Tricks - RexEgg
This regex is what's known as a "zero-width match" because it matches a position without matching any actual characters. How does it work?...
Read more >Lookahead and Lookbehind Zero-Length Assertions
Lookahead and lookbehind, collectively called “lookaround”, are zero-length assertions just like the start and end of line, and start and end of word ......
Read more >Lookahead and lookbehind - The Modern JavaScript Tutorial
Lookahead allows to add a condition for “what follows”. Lookbehind is similar, but it looks behind. That is, it allows to match a...
Read more >Using Look-ahead and Look-behind - PerlMonks
html#Extended-Patterns, you can "roll your own" zero-width assertions to fit your needs. You can look forward or backward in the string being ...
Read more >16 Regular expressions: lookaround assertions by example
Negative lookahead: (?!«pattern») matches if pattern does not match what comes after the current location in the input string. Lookbehind assertions (ECMAScript ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve wanted this as well — I definitely think it’s a good idea, that shouldn’t add significant implementation complexity.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.