Brent Clark wrote:
Hiya

Hello,

I got a string like so, and for the likes of me I can get regex to have it that each line is starts with #abc#.

my $a = "#aaa#message:details;extra:info;variable:times;#bbb#message:details;extra:info;variable:times;#ccc#not:always;the:same;ts:14:00.00;";
$a =~ s/(?<!#.#)/$1\n/i;

You are using a zero-width negative look-behind assertion which does not capture its contents. You are using a pattern that matches a total of three characters but you say you want to match five characters. You are using the /i option but there are no characters in the pattern that are affected by the /i option.

You probably want something like:

$x =~ s/(#...#[^#]*)/$1\n/g;



John
--
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to