开发者

negative lookbefore for a blackslash in ruby 1.9

开发者 https://www.devze.com 2022-12-18 03:47 出处:网络
I want to match every \'[\' or \']\' that\'s not preceded by a backslash in ruby 1.9 I tried: /?&开发者_开发百科lt;!\\134[\\[\\]]/

I want to match every '[' or ']' that's not preceded by a backslash in ruby 1.9 I tried:

/?&开发者_开发百科lt;!\134[\[\]]/

and

/?<!\\\\[\[\]]/

but I get a 'target of repeat operator not specified'


You will need to wrap the negative lookbehind in parenthesis.

(?<!\\)[\[\]]
0

精彩评论

暂无评论...
验证码 换一张
取 消