
PCRE is the regex engine used by the TPerlRegEx Delphi component and the RegularExrpessions and RegularExpressionsCore units in Delphi XE and C++Builder XE. The feature set described here is available in PCRE 5.x and 6.x. Versions prior to 5.6 do not support Unicode. Perl: The regex flavor used in the Perl programming language, versions 5.6 and 5.8.It is generally also the regex flavor used by applications developed in Java. A few features were added in Java 5 (JDK 1.5.x) and Java 6 (JDK 1.6.x). Java: The regex flavor of the package, available in the Java 4 (JDK 1.4.x) and later.It is generally also the regex flavor used by applications developed in these programming languages.


NET: This flavor is used by programming languages based on the Microsoft.

Here are some references that summarize the differences.Regular Expression Engine Comparison Chart So if you take an arbitrary JavaScript regex and transliterate it to Java (as above) it might not work. However as notes, there are various differences between the regex languages implemented by Java and JavaScript. Just remember that you are using a Java string literal to express the regex. This is a bit confusing / daunting for Java novices, but it is totally logical. (And if you have a literal backslash character in the regex, you end up with "\\\\" in the Java string literal!!) But '\' is the escape character in a Java string literal, so each '\' in the original regex has to be escaped with a 2nd '\'. Instead, they are (typically) expressed using Java string literals. Unlike, JavaScript, Perl and other scripting languages, Java doesn't have a special syntax for regexes. Open TOOLS -> Code Generator (LANGUAGE - Java)Įven though it isn't hardcore programmer way, it is significantly less error-prone.Įspecially if you need to convert only one or two expressions.Ĭhange the leading and trailing '/' characters to '"', and then replace each '\' with "\\".You can use online regex evaluators like for conversion.
