dominic01 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to split the following line and would like to process individual parts.
my $RefLine = "(a) This is first line. (b) This is second line; (c) Th +is is different line 32. (d) Here is the last line."; $RefLine =~ /^(\([a-z]\) .+ (?=\([a-z]\)))(.*?)/; print "01\t$1\n02\t$2\n03\t$3\n";
I am not actually splitting in the above example but I am trying to make a match so that I can split individual lines. Here in my case the pattern matches "(a) .... to 32." Not sure how to get them in an array like
(a) This is first line.
(b) This is second line;
(c) This is different line 32.
(d) Here is the last line.
Appreciate any help
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: RegEx related line split
by johngg (Canon) on Nov 11, 2011 at 17:59 UTC | |
by dominic01 (Sexton) on Nov 14, 2011 at 03:13 UTC | |
by johngg (Canon) on Nov 14, 2011 at 10:30 UTC | |
by johngg (Canon) on Nov 14, 2011 at 10:27 UTC | |
by Gavin (Archbishop) on Nov 14, 2011 at 10:41 UTC | |
|
Re: RegEx related line split
by Lotus1 (Vicar) on Nov 11, 2011 at 21:58 UTC | |
by dominic01 (Sexton) on Nov 14, 2011 at 03:17 UTC | |
by remiah (Hermit) on Nov 14, 2011 at 08:54 UTC | |
by JavaFan (Canon) on Nov 14, 2011 at 11:41 UTC | |
by remiah (Hermit) on Nov 14, 2011 at 12:40 UTC |