http://qs321.pair.com?node_id=11137037


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.