in reply to matching substring in url

echo "$XXX" | perl -ne '/\/(\w+);/ and print $1'

Replies are listed 'Best First'.
Re^2: matching substring in url
by cioperl (Novice) on Nov 08, 2019 at 18:45 UTC
    Unfortunately, semicolon ";" is not guaranteed, so this won't work -- the part starting with (and including) ";" may or may not appear in the url.
    Any other suggestions?

      In that case:

      echo "$XXX" | perl -ne '/\/(\w+)[^\/]*?$/ and print $1'