use Data::Dumper; $string = "sp Hello there sp \n Hey hey sp How are you? sp I need a ds +p chip and have a spelling test."; @results = $string =~ m/\bsp\s+(.*?)\s+sp\b/g; print Data::Dumper->Dump([\@results]); __OUTPUT__ $VAR1 = [ 'Hello there', 'How are you?' ];
--
flounder
In reply to Re: Regular expressions
by flounder99
in thread Capturing text between literal string delimiters (was: Regular expressions)
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |