4 ms·
I've used lookbehind assertions (and negative lookbehind assertions) many times. Most recently I used them to do some complex find/replaceing across a pretty l
by solipsism 11y ago
I've used lookbehind assertions (and negative lookbehind assertions) many times. Most recently I used them to do some complex find/replaceing across a pretty large codebase. My editor supports regex, and I'm glad it does because it made the job easy.
From what I see these additions become useful long past the point where using a regex was sensible in the first place.
Regex stops being a sensible solution when your pattern starts getting overly complex. The fact that you use one of these features doesn't imply your pattern is overly complex. These are not complex features, they're easy to use, and often extremely useful. For example when straightforward find/replace doesn't cut it. What would you suggest, I take 10 minutes to write a Python script for what took me about 15 seconds in my editor's Find/Replace box?
- lolc 11y agoI see how this can be useful for ad-hoc replacements. To clarify, I'm not asking about the usefulness of the feature in general but why it makes sense to add this to JS.
- paulddraper 11y agoBecause JS is a general purpose language?