# strmatch

Matches the target string with the regular expression.

## Format

    strmatch <target string> <string with regular expression>

## Remarks

Supports Oniguruma Regular Expressions.
This command searches the <target string> with the <string with regular expression>.
The "strmatch" command returns one of the following values in the system variable "result":

Value | Meaning
--- | ---
0 | Not matched.
1 | Matched offset(1origin).

The first matched pattern is stored in the system variable "matchstr".
Group matched patterns of regular expressions are stored in 9 system variables from "groupmatchstr1" to "groupmatchstr9".
Also, these system variables will not be changed when the pattern does not match.

## Example

    strmatch 'Microsoft Windows XP [Version 5.1.2600]' '\[(Version (\d+).(\d+).(\d+))\]'

    int2str s result
    messagebox s 'result'                        ; 22
    messagebox matchstr 'matchstr'               ; [Version 5.1.2600]
    messagebox groupmatchstr1 'groupmatchstr1'   ; Version 5.1.2600
    messagebox groupmatchstr2 'groupmatchstr2'   ; 5
    messagebox groupmatchstr3 'groupmatchstr3'   ; 1
    messagebox groupmatchstr4 'groupmatchstr4'   ; 2600

## Reference

strreplace
strinsert
strremove