next up previous contents index
Next: Efficiency considerations. Up: regmatch: Regular Expression Matching Previous: Extracting the matches.   Contents   Index

Substitution.

The predicate re_substitute/4 has the following invocation:
    re_substitute(+InputStr, +SubstrList, +SubstitutionList, -OutStr)
This predicate works exactly like string_substitute/4 described in Section 1.6, except that the result of the substitution is not interned (for the same reason as in re_substring/4. This predicate will become an alias to string_substitute/4 when atom garbage collection will be added to XSB.
| ?- re_bulkmatch('[^a-zA-Z0-9]+', '123&*-456 )7890| 123', 0, _, X),
     re_substitute('123&*-456 )7890| 123', X, ['+++'], Y).

X = [match(3,6),match(9,11),match(15,17)]
Y = 123+++456+++7890+++123



Luis Fernando P. de Castro 2003-06-27