hound-search/hound

Lookaround assertions in regular expressions?

Open

#305 建立於 2019年2月19日

在 GitHub 查看
 (2 留言) (7 反應) (0 負責人)JavaScript (5,470 star) (606 fork)batch import
enhancementhelp wanted

描述

If I write a regular expression with a (positive or negative) lookahead (or lookbehind) assertion I get an error saying it's incorrect Perl syntax.

For example to look for the text "function" that's not followed by an underscore, I might use this: function(?!_)

However that returns the error: ERROR:error parsing regexp: invalid or unsupported Perl syntax: (?!

However they do work in Perl!

Any ideas?

PS: In this toy example I could use a negated character class function[^_] for searching, but I'm interested in the general case rather than a solution to a specific pattern.

貢獻者指南