Both languages claim to use Perl style regular expressions. If I have one language test a regular expression for validity, will it work in the other? Where do the regular expression syntaxes differ?
The use case here is a C# (.NET) UI talking to an eventual Java back end implementation that will use the regex to match data.
Note that I only need to worry about matching, not about extracting portions of the matched data.
There are quite (a lot of) differences.
Character Class
[abc-[cde]][abc&&[^cde]])[abc&&[cde]][abc-[^cde]])\p{Alpha}POSIX character class(?x)modeCOMMENTS/IgnorePatternWhitespace, space (U+0020) in character class is significant.\p{L}form only\pL,\p{L},\p{IsL}\p{general_category=L},\p{gc=L}\p{Lu}form only\p{Lu},\p{IsLu}\p{general_category=Lu},\p{gc=Lu}\p{IsBasicLatin}only. (Supported Named Blocks)\p{InBasicLatin}\p{block=BasicLatin},\p{blk=BasicLatin}BasicLatincan be written asBasic_LatinorBasic Latin)Quantifier
?+,*+,++and{m,n}+(possessive quantifiers)Quotation
\Q...\Eescapes a string of metacharacters\Q...\Eescapes a string of character class metacharacters (in character sets)Matching construct
(?(?=regex)then|else),(?(regex)then|else),(?(1)then|else)or(?(group)then|else)(?<name>regex)or(?'name'regex)\k<name>or\k'name'(?<name>regex)\k<name>(?<name1-name2>regex)or(?'name1-name2'subexpression)Assertions
(?<=text)(positive lookbehind)(?<!text)(negative lookbehind)Mode Options/Flags
ExplicitCaptureoption(?n)Miscellaneous
(?#comment)inline commentsReferences