in reply to Regex for splitting a string on a semicolon (conditionally)
> ...but this returns in the number of matching semicolons ("2" in this case). This has been driving me absolutely nuts--any help is appreciated!
$text =~ s/\;(?=(\s[A-Z]{1}[a-z]+,\s([a-zA-z]\.-?)+\,))/\n/g;
does the substitution in $text but returns their number in scalar context.
drop $part and do my @parts = split("\n",$text);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex for splitting a string on a semicolon (conditionally)
by grouse (Initiate) on Feb 12, 2015 at 09:16 UTC |