Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What RegEx engine is used in ColdFusion 9?

When developing regular expressions it helps not only to know what the limitations are as seen here: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec0a38f-7ff3.html , but also what the grammar and syntax expected is. It also helps during testing for apps that can select a Regex engine to test with against a test bed of text or files.

I've seen posted here and there that CF uses Jakarta ORO, http://jakarta.apache.org/oro/ , which is retired late 2010 so that can't be correct or is it still baked into CF9?

If CF10 ships with a different Regex engine as CF9 please also include if known.

like image 813
Sn3akyP3t3 Avatar asked May 31 '12 22:05

Sn3akyP3t3


People also ask

Which regex engine does Python use?

Python has two major implementations, the built in re and the regex library. Ruby 1.8, Ruby 1.9, and Ruby 2.0 and later versions use different engines; Ruby 1.9 integrates Oniguruma, Ruby 2.0 and later integrate Onigmo, a fork from Oniguruma.

Which regex engine does Java use?

It is generally also the regex flavor used by applications developed in these programming languages. Java: The regex flavor of the java. util. regex package, available in the Java 4 (JDK 1.4.

How does a regex engine work?

A regex engine executes the regex one character at a time in left-to-right order. This input string itself is parsed one character at a time, in left-to-right order. Once a character is matched, it's said to be consumed from the input, and the engine moves to the next input character.

What is regex used for in programming?

Regex has its own terminologies, conditions, and syntax; it is, in a sense, a mini programming language. Regex can be used to add, remove, isolate, and manipulate all kinds of text and data. It could be used as a simple text editor command, e.g., search and replace, or as it's own powerful text-processing language.


Video Answer


1 Answers

CF9 and CF10 both use Jakarta ORO v2.0.6 - changing it for the existing functions would break backwards compatibility, since other regex engines use different syntax (for both matching and replacement).

However, you can access the java.util.regex package from CF, which provides access to the version of that engine which your JRE uses, using createObject/type=java

If you're not comfortable working with Java classes yourself, I have created a project which wraps the java.util.regex library into a set of handy CFML functions, see cfregex.net for more details.

like image 168
Peter Boughton Avatar answered Nov 24 '22 03:11

Peter Boughton