Result = CreateRegularExpression(#RegularExpression, Pattern$ [, Flags])
Create a new regular expression using the specified pattern.


#RegularExpression A number to identify the new regular expression. #PB_Any can be used to auto-generate this number.
Pattern$ The regular expression which will be applied to the string to match, extract or replace.
Flags (optional) It can be a combination of the following values:
  #PB_RegularExpression_DotAll    : '.' matches anything including newlines.
  #PB_RegularExpression_Extended  : whitespace and '#' comments will be ignored.
  #PB_RegularExpression_MultiLine : '^' and '$' match newlines within data.
  #PB_RegularExpression_AnyNewLine: recognize 'CR', 'LF', and 'CRLF' as newline sequences.
  #PB_RegularExpression_NoCase    : comparison and matching will be case-insensitive

Return value

Returns nonzero if the regular expression was created successfully and zero if not. If #PB_Any was used for the #RegularExpression parameter then the generated number is returned on success. If an error has been detected in the pattern, the result will be zero. To get more information about the error, see RegularExpressionError().


If a regular expression isn't used anymore, use FreeRegularExpression() to free up some resources.


  ; This expression will match every word of 3 letter which begin by a lower case letter,
  ; followed with the character 'b' and which ends with an uppercase letter. ex: abC
  If CreateRegularExpression(0, "[a-z]b[A-Z]")
    Debug MatchRegularExpression(0, "abC") ; Will print 1
    Debug MatchRegularExpression(0, "abc") ; Will print 0
    Debug RegularExpressionError()

See Also

RegularExpressionError(), FreeRegularExpression()

Supported OS


RegularExpression Index - ExtractRegularExpression() ->