8. Search and replace

[<<<] [>>>]

re::replace(string,regexp,replace)
re::s(string,regexp,replace)
This function searches the string for matches of the regular expression and replaces the actual matches with the replace string. This is the same functionality as the =~s/ operator in Perl.

The function fills the dollar array the same way as the function match.

For example

import re.bas

print re::s("almakbat*","a(.)","$1s") print print re::$(0)," ",re::$(1) print

will print

lsmksbts*
at t

As you can see in this case the value of re::$(0) is the string that was matched by the last replace inside the string.


[<<<] [>>>]