in reply to Parsing/regex help required
First be sure if you have HTML you need to be using an HTML parser, not regex, to extract your lines.
Presumably this is something where the numbering's not generated by say an <ol> and you've actually pulled the text of whatever nodes out (using say HTML::TreeBuilder or Mojo::DOM) then you could use something maybe like.
my( $num, $text1, $text2 ) = $line_from_html =~ m{^ (\d+) \. \s+ (.*?) + \s+-\s+ (.*?) $}x;
Edit: Tweaked.
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Parsing/regex help required
by Anonymous Monk on Sep 27, 2021 at 13:49 UTC | |
by Fletch (Bishop) on Sep 27, 2021 at 19:50 UTC | |
by AnomalousMonk (Archbishop) on Sep 27, 2021 at 20:01 UTC |
In Section
Seekers of Perl Wisdom