The code, that transforms regex rule into a JavaScript assumes it starts with / and ends with /. In PHP however there are no such restriction. This way if somebody adds new regex rule using different delimiters it would result in JavaScript error.
I see following options:
- either enforce specific delimiter usage (the
/ specifically) - easier to do, but eposes fact, that JavaScript is generated inernally
- or replace used delimiter with
/ when converting to JavaScript - better, but would require escaping new delimiter inside regex as well
The code, that transforms regex rule into a JavaScript assumes it starts with
/and ends with/. In PHP however there are no such restriction. This way if somebody adds new regex rule using different delimiters it would result in JavaScript error.I see following options:
/specifically) - easier to do, but eposes fact, that JavaScript is generated inernally/when converting to JavaScript - better, but would require escaping new delimiter inside regex as well