in reply to Regular Expressions Problem
That will replace a / with a \, but only one. Quite likely you need to replace many. The /g switch does that, but there is another trick it is worth knowing (many actually, but we'll focus on just this one). Consider:
my $doc = 'This /and/ that.'; $doc =~ s!/!\\!g; print $doc;
Prints:
This \and\ that.
Note the use of ! to delimit the regex parts to avoid the picket fence effect you get using the default / and needing to quote stuff with \.
For more regex goodness see perlretut and perlre.
|
|---|