hound-search/hound

Lookaround assertions in regular expressions?

開放

#305 建立於 2019年2月19日

 (2 則留言) (7 個反應) (0 位負責人)JavaScript (606 個分叉)batch import
enhancementhelp wanted

倉庫指標

星標
 (5,470 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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.

貢獻者指南