4.84 regexrep - Replace Match String

Format 1: regexrep($str$,regular expression,replacement string)

Format 2: regexrepw($str$,regular expression,replacement string)

Return the starting position of the longest substring where the defined regular expression matches with the character string $str$. Use the regexrepw function if $str$ or regular expression contain multibyte characters, or when characters in Shift_JIS encoding does not correspond to search results.

Example

Example 1: Basic Example

In row where id=1,id=2, the matched substrings in the column is replaced with MMM.

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