Squiffy doesn't recognize regex "(/(?<=x)y/," but does recognize "(/y(?=x)/,". What gives?

I can tell Squiffy's javascript: "If x comes after y, do something to y but leave x alone."
I can't tell Squiffy's javascript: "If x comes before y, do something to y but leave x alone."

Is Squiffy using an out-of-date regex or something? Am I doing something wrong?

Thanks

Update: Apparently the "positive lookbehind" feature is not universally recognized. It actually works when I compile my game, but not in the Squiffy editor. Are there any equivalent features for older browsers and editors?


Most browsers now support lookbehind, but it might be better to avoid it.
This is a good reference → https://caniuse.com/js-regexp-lookbehind

If you're using this as part of a replacement pattern, it might be easier to match both x and y, and then add x onto the beginning of the replacement string. Obviously, the complexity of doing this will depend on how complex your pattern is. I can offer a more specific example if you have an example of what you're trying to use it for.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums