CreateRegularExpression()

Syntax

Result = CreateRegularExpression(#RegularExpression, Pattern$ [, Flags])
Description
Create a new regular expression. If #PB_Any is used as '#RegularExpression' parameter, the new regular expression number will be returned as 'Result'. 'Pattern$' is the regular expression which will be applied to the string to match, extract or replace string information. If an error has been detected in the pattern, 'Result' will be 0. To get more information about the error, see RegularExpressionError().

If a regular expression isn't used anymore, use FreeRegularExpression().

'Flags' 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.
Example:
  ; 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 be 1
    Debug MatchRegularExpression(0, "abc") ; Will be 0
  Else
    Debug RegularExpressionError()
  EndIf

Supported OS

All

RegularExpression Index - ExtractRegularExpression() ->