Open slevithan opened 12 years ago
@fileformat I see you've added XRegExp support in commit e2333b8ab627217b2404411d64180d197ccd1453, and that the XRegExp version of the tester is now live. That's awesome!
A few issues to report about the XRegExp support, though.
Not specific to XRegExp:
+
signs in the results (in the input, replace, split, and exec columns). Spaces are also replaced with pluses in the regex source, which sometimes leads to syntax errors.input.replace
column should be labeled input.replace()
, for consistency with the other columns.input.split
column should be labeled input.split()
, for consistency with the other columns.regex.exec()[]
column should be labeled regex.exec()
, unless the split column is labeled input.split()[]
.Specific to XRegExp:
XRegExp.install('natives')
when it first loads (if running the XRegExp tester rather than native JavaScript tester), to enable the XRegExp replacement text syntax. Alternatively, you could pass the input through XRegExp.replace
instead of String.prototype.replace
, in which case you wouldn't need the XRegExp.install('natives')
line.s
, x
, and n
are never actually applied, even when their checkboxes are checked.y
. XRegExp supports flag y
only in JavaScript environments that natively support it (i.e., Firefox 3+). Node.js/V8 does not support flag y
, so it would cause an error if RegexPlanet actually applied it.Feature requests, specific to XRegExp:
regex.exec()
column. To do this, you'd need to loop over properties of the result array. In order for named backreferences to actually show up on the result array, you'd need to either run the XRegExp.install('natives')
line that I mentioned earlier (after loading XRegExp), or pass the input through XRegExp.exec
rather than RegExp.prototype.exec
.A
, and its corresponding support for supplementary/astral Unicode code points.length
or __proto__
is now an error.\p{L}
can now be written as \pL
.The full list of changes is currently in the roadmap. The release of v3.0.0-final might be delayed for a while since I need to focus on other projects, which is why I think it makes sense to go ahead and upgrade early. Flag A
, in particular, would be very useful to test with.
If you have any questions, I'd be happy to help!
Are you interested in adding an XRegExp backend (separate from the standard JavaScript backend)? It should be easy to do, since you already support JavaScript with Node.js. You'd probably just need to include XRegExp (
var XRegExp = require('xregexp').XRegExp;
, after installing with npm), add checkboxes for XRegExp's three nonnative flags (s
,x
, andn
), and use XRegExp.replace/exec/test/split rather than the native methods, for testing.Actually, since XRegExp compiles to native regexes, you don't even need to use
XRegExp.exec
/test
/split
. You do needXRegExp.replace
, to use XRegExp's replacement text syntax. You'd probably also want to useXRegExp.exec
, so that you get named backreferences on the result array.If you have any questions or run into any issues, I'd be happy to help.