ExtractRegularExpression()

Syntax

Result = ExtractRegularExpression(#RegularExpression, String$, Array$())
Description
Extracts strings according to the #RegularExpression into an array.

Parameters

#RegularExpression The regular expression to use.
String$ The string to apply the regular expression on.
Array$() The extracted strings will be stored in this array. The array is automatically resized to the number of element matching the expression found in the specified string.

Return value

Returns the number of elements matching the regular expression in the string.

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]")
    Dim Result$(0)
    NbFound = ExtractRegularExpression(0, "abC ABc zbA abc", Result$())
    For k = 0 To NbFound-1
      Debug Result$(k)
    Next
  Else
    Debug RegularExpressionError()
  EndIf

See Also

CreateRegularExpression()

Supported OS

All

<- CreateRegularExpression() - RegularExpression Index - FreeRegularExpression() ->