SFLEX has asked for the wisdom of the Perl Monks concerning the following question:
my @AUBBC_TAGS = ('b','i','sub','sup','pre','ul','ol','small','big','l +i','p','h1','h2','h3','h4','h5','h6','div','strong'); my $message = '[b] stuff [i] stuff [/i] [/b]'; foreach (@AUBBC_TAGS) { $message =~ s{\[(.?)?$_\]}{<$1$_>}xg; } print $message;
my $message = '[b] stuff [i] stuff [/i] [/b]'; $message =~ s{\[(.?)?([\w]+)\]}{<$1$2>}xgo; print $message;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Want a faster replace, Please
by Kanji (Parson) on Sep 12, 2010 at 13:12 UTC | |
|
Re: Want a faster replace, Please
by Khen1950fx (Canon) on Sep 12, 2010 at 13:17 UTC | |
by JavaFan (Canon) on Sep 12, 2010 at 18:14 UTC | |
|
Re: Want a faster replace, Please
by jwkrahn (Abbot) on Sep 12, 2010 at 14:59 UTC | |
|
Re: Want a faster replace, Please
by JavaFan (Canon) on Sep 12, 2010 at 18:11 UTC | |
|
Re: Want a faster replace, Please
by Anonymous Monk on Sep 12, 2010 at 20:47 UTC |