4.81 regexm - Complete Match

Format 1: regexm($str$,regular expression)

Format 2: regexmw($str$,regular expression)

Return true if the regular expressions matches the whole character string $str$. Use regexmw function if multibyte characters exists in $str$ or regular expression, or characters in Shift_JIS encoding does not correspond to search results.

Examples

Example 1: Basic Example

Both records where id=1,id=2 contains regular expression beginning with c and ends with aa, in record id=2, there is only partial match (matches from c at the second position to the end) with the regular expression.

$ more dat1.csv
id,str
1,caabaa
2,acabaaa
3,
4,bbcbcc
$ mcal c='regexm($s{str},"c.*aa")' a=rsl i=dat1.csv o=rsl1.csv
#END# kgcal a=rsl c=regexm($s{str},"c.*aa") i=dat1.csv o=rsl1.csv
$ more rsl1.csv
id,str,rsl
1,caabaa,1
2,acabaaa,0
3,,0
4,bbcbcc,0

Example 2: String ends with same substring

The full string in column $str$ that matches the regular expression .*c is only found in the record where id=4.

$ mcal c='regexm($s{str},".*c")' a=rsl i=dat1.csv o=rsl2.csv
#END# kgcal a=rsl c=regexm($s{str},".*c") i=dat1.csv o=rsl2.csv
$ more rsl2.csv
id,str,rsl
1,caabaa,0
2,acabaaa,0
3,,0
4,bbcbcc,1

Example 3: Match blank characters

Match the blank characters at id=3 using the regular expression ^$.

$ mcal c='regexm($s{str},"^$")' a=rsl i=dat1.csv o=rsl3.csv
#END# kgcal a=rsl c=regexm($s{str},"^$") i=dat1.csv o=rsl3.csv
$ more rsl3.csv
id,str,rsl
1,caabaa,0
2,acabaaa,0
3,,1
4,bbcbcc,0