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.
精彩评论