Howdy,
I'm trying to unescape text that may mean something special when this text is in a variable that's being used in a regular expression, here's an example:
my $foo = "[hello]"; my $bar = "agabaga[hello]zoomzoomzoom"; my $buzz = "goodbye"; $bar =~ s/$foo/$buzz/gi; print "\n$bar\n";
this will faithfully print out:
agabagagoodbyegoodbyegoodbyegoodbyegoodbyezgoodbyegoodbyemzgoodbyegoodbyemzgoodbyegoodbyem
Which isn't exact.y what I wanted, I just wanted hello to be replaced with goodbye. I'm using lil psuedo tags like this for a small templating system, I really like brackets like this, and it seems that there should be an easy way to escape the stuff that the variable holds.
Does anyone know how?
btw, has anyone realized the search on this site is useless? You receive about 100 results that don't help ya out much.
-justin simoni
!skazat!
In reply to Regular Expressions and Variables by skazat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |