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

7.1.0.0.3 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



Terrance Swift 2007-10-06