next up previous contents index
Next: 8.4 Unloading Perl Up: 8. perlmatch: Perl-based String Previous: 8.2 Bulk Matching   Contents   Index

8.3 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?



Terrance Swift 2007-10-06