Uses a regular expression (RE) to search a string for a pattern, starting from a specified position.

reMatch(reg_expression, string) → returns array

Argument Reference

reg_expression string

Regular expression for which to search. Case-sensitive.

string string

A string or a variable that contains one. String in which to search.

Links more information about reMatch

Sample code invoking the reMatch function

Extracts numbers from a string and returns them as an array

serializeJSON( reMatch("[0-9]+", "1 way to extract any number like 45, 38") )

Expected Result: ["1","45","38"]

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub