next up previous contents index
Next: Unloading Perl Up: Using Perl as a Previous: Bulk Matching   Contents   Index

String Substitution

The last feature of the XSB-Perl interface is string substitution based on pattern matching. This is achieved through the predicate string_substitute/3:


  :- perl_substitute(+String, +PerlSubstitutionExpr, -ResultString).

We assume you are familiar with the syntax of Perl substitution expressions. Here we just give an example of what kind of things are possible:


  :- perl_substitute('this is fun', 's/(this) (is)(.*)/\2 \1\3?/', Str).
  Str=is this fun?



Baoqiu Cui
2000-04-23