开发者

regular expression converter (from PHP to JavaScript)

This is the PHP regular expression I would like to convert into a JavaScript regular expression:

/(?<!\..|\...|\....)([\?\!\.]+)\s(?!.\.|..\.|..开发者_运维技巧.\.)/u

Are there tools to do such a conversion?


(?<!stuff goes here) is a negative lookbehind which isn't supported by JavaScript's regex implementation. There are some ways to mimic it, but it does not work properly for all cases - yours looks like one of those to me.

If you want to keep using this specific regex, but from JavaScript, you could consider simply passing the string to PHP using Ajax, which would then run the regex on it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜