Whatever message this page gives is out now! Go check it out!

REMatch

Last update:
May 18, 2026

Description

Uses a regular expression (RE) to search a string for a pattern, starting from a specified position. The search is case sensitive. For more information on regular expressions, including escape sequences, anchors, and modifiers, see Using Regular Expressions in Functions in the Developing ColdFusion Applications.

Returns

An array of strings that match the expression.

Category

History
  • ColdFusion (2018 release) Update 5: Added the flag useJavaAsRegexEngine to Application.cfc. Enable this flag to use Java Regex as the default regex engine. For more information, see Application variables. For information on using Regular Expression using the flag, see Using Regular Expressions.
Function syntax
REMatch(reg_expression, string)

See also

Parameters

Parameter
Description
reg_expression
Regular expression for which to search. Case sensitive.For more information, see Using Regular Expressions in Functions in the Developing ColdFusion Applications.
string
A string or a variable that contains one. String in which to search.

Usage

This function finds all occurrences of a regular expression in a string.

Example

<cfhttp url="https://www.adobe.com" 
 method="get" result="httpResp" timeout="120">
    <cfhttpparam type="header" name="Content-Type" value="application/json" />
</cfhttp>
<cfscript>
    // Find all the URLs in a web page retrieved via cfhttp
    // The search is case sensitive
   result = REMatch("https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?", httpResp.Filecontent);
   writeDump(result)
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page