I need to convert Java regular expressions into Actionscript regular expressions.
There apparently aren't any premade converters, so I'm trying to write one myself. Is there any resource that'd list all the differences?
I'm aware of regular-expressions.info, but there doesn't seem to be a comprehensive listing of differences there.
Thanks
I don't know of any existing converter, but if your target is specifically ActionScript and not just any ECMA-262 implementation, the job could be easier than you expected. AS3 is powered by PCRE, same as PHP's preg_
functions, so it supports lookbehind, atomic groups and possessive quantifiers, same as Java. It also supports Java's dotall and extended modes in addition to JS's ignore-case and multiline. It supports the inline modifier syntax ((?imsx)
) as well.
PCRE's Unicode support is better than Java's, but unfortunately, I don't think that's included in ActionScript. The Unicode functionality seems to be explicitly tied to the character encoding, which is UTF-8 in PCRE; I believe ActionScript uses UTF-16 in accordance with ECMA-262. Anyway, its Unicode support seems to be minimal, same as JavaScript's.
Here is a breakdown:
java.util.regex RegExp.prototype Character class set operations (?#…) comment patterns Named capture The /y (sticky) modifier The /x (extended) modifier \u10000+ Codepoints Possessive quantifiers Quotation Exception Handling Linebreak matcher
References
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With