$WBRXE - execute a regular expression

Availability
$WBRXE is available for use with all WBSP commands.

Syntax
$WBRXE{source|pattern|arrayname|global|ignorecase|showvar}
$WBRXE[source|pattern|arrayname|global|ignorecase|showvar]

Parameters
sourcetext - text on which to perform the search
pattern - regular expressions pattern
arrayname - the name of the array where elements will be stored and prefix for array where positions will be stored (arrayname_pos).
global - optional parameter - a True/False value that indicates if a pattern should match all occurrences in an entire sourcetext or just the first one
ignorecase - optional parameter - a True/False value that indicates if a pattern search is case-sensitive or not
showvar - optional parameter - if set to true (T,ON,1) WhizBase will show the last index (length-1) of resulting array


Returns
Number of elements in resulting array if showvar parameter is set to true, otherwise it returns nothing, just creates the array.

Example

<!--
[FormFields]
wb_command=r
-->
<!--WB_BeginTemplate-->
<html>
<head>
<title>Titles</title>
</head>
<body>
String: $wbsetv[rxstr|IS1 is2 IS3 is4|t]<br>
Pattern: $wbsetv[rxp|is.|t]<br>
Number of occurrences: $wbsetv[MCount|$WBRXE[$wbgetv[rxstr]|$wbgetv[rxp]|match|t|t|t]|t]<br>
$wbsetv[LCount|$wbcalc[$wbgetv[Mcount]-1]]
$wbwhile[$wbgetv[Lcount]>=0|
$wbgetv[match($wbgetv[LCount])] at position $wbgetv[match_pos($wbgetv[LCount])]<br>
$wbsetv[LCount|$wbcalc[$wbgetv[LCount]-1]]
]
</body>
</html>

After running this example, the resulting page in browser, may look like this:

String: IS1 is2 IS3 is4
Pattern: is.
Number of occurrences: 4
is4 at position 12
IS3 at position 8
is2 at position 4
IS1 at position 0