$regex » History » Version 5
Per Amundsen, 08/13/2015 10:34 AM
| 1 | 1 | Per Amundsen | _Added in 1.9.0_ |
|---|---|---|---|
| 2 | |||
| 3 | *$regex([name], text, re)* |
||
| 4 | |||
| 5 | 5 | Per Amundsen | Returns the number of strings in text that matched the [[Scripting_Regex|regular expression]]. |
| 6 | 1 | Per Amundsen | |
| 7 | *Parameters* |
||
| 8 | |||
| 9 | 3 | Per Amundsen | [name] - Name of the search, which can later be referenced using [[$regml]]. (optional) |
| 10 | 1 | Per Amundsen | text - The text to search. |
| 11 | 4 | Per Amundsen | re - The [[Scripting_Regex|regular expression]] to perform. |
| 12 | 1 | Per Amundsen | |
| 13 | *Example* |
||
| 14 | |||
| 15 | <pre> |
||
| 16 | ; Search the text for the pattern '(hello)' and print the result. |
||
| 17 | //echo -ag Number of matches: $regex(Hello World, /(hello)/) match 1 is: $regml(1) |
||
| 18 | 2 | Per Amundsen | </pre> |