kidd has asked for the wisdom of the Perl Monks concerning the following question:
I have this problem that has been driving me nuts, and I can't find the answer...
Lets say I have this code:
As you can see its a string with special command [color=blue] wich I want to substitute for "<font color="blue">" and [/color] to "</font>"...my $text = 'This test creates a [color=blue] blue [/color] word. And a + [color=red] red [/color] one';
Now here is the code I've been trying out:
Now...according to me "@colors" should print out:my ($color,@colors); my $new = $text; @colors = $new =~ m/\[color=.*\]/gi; print @colors;
[color=blue] [color=red]
Wich it isnt happening...could someone help me out... THANKS
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Regexp
by dws (Chancellor) on Jul 25, 2002 at 20:40 UTC | |
Re: Regexp
by thelenm (Vicar) on Jul 25, 2002 at 20:42 UTC | |
Re: Regexp
by elusion (Curate) on Jul 25, 2002 at 20:42 UTC | |
Re: Regexp
by mkmcconn (Chaplain) on Jul 25, 2002 at 20:40 UTC | |
by Anonymous Monk on Jul 25, 2002 at 21:24 UTC | |
by mkmcconn (Chaplain) on Jul 25, 2002 at 21:36 UTC | |
Re: Regexp
by kidd (Curate) on Jul 25, 2002 at 20:45 UTC | |
OT: Deprecated Element
by BorgCopyeditor (Friar) on Jul 25, 2002 at 21:55 UTC |
Back to
Seekers of Perl Wisdom