question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feature request: zero-width lookahead/-behind expression in the Matcher

See original GitHub issue

The 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:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
honnibalcommented, Apr 28, 2018

I’ve wanted this as well — I definitely think it’s a good idea, that shouldn’t add significant implementation complexity.

0reactions
github-actions[bot]commented, Oct 20, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found