Method RegEx():quickMatch() Foundation

Performs a one-time pattern match.

Syntax
:quickMatch( <cPattern>, <cSubject> ) --> aMatch
Parameters
<cPattern>
The regular expression pattern.
<cSubject>
The subject string to search.
Return

An array with match results. The match results are returned in an array of the same format as returned by the method :match(). See there for a detailed description. Also see the helper methods :getMatchText(), :getMatchPos() and :getMatchRange() which simplify the processing of the match results.

Description

Convenience class method for performing a single match operation without having to first create a persistent RegEx object. Ideal for one-off matches where pattern reuse is not needed.

Get match text

aMatch := RegEx():quickMatch("\d+", "Version 2.5") 
? RegEx():getMatchText(aMatch)  // "2" 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.