in reply to Extract substring from a string

Learning how to parse the XML, or whatever it is, will serve you well as your needs grow.

On a quick and dirty basis:

$p = $s =~ s{\<strong\>(.*?)\</strong\>}{ $1 } ? $1 : undef ;
should replace any <strong>....</strong> by ' .... ' in $s, and set $p to be a copy of the '....'.

Mind you, this leaves as an exercise:

  1. how you read stuff into $s
  2. if reading line by line, how to deal with <strong>....</strong> sections that span one or more lines
  3. in any event, how to deal with pesky CRLF sequences, if there are any
  4. whether changing foo<strong>FOO</strong>bar to foo FOO bar is really what you want -- that is, do you want to introduce space(s) where there were none before ?
  5. how any nested <strong>..</strong> sections are to be handled -- which the fragment above fails on, utterly
Some, or all, of which may be dealt with by biting the bullet and parsing the thing.