in reply to Extract substring from string with no whitespace using regexp?

I need a way to return just the matched pattern from the whole matched string.
Use $&! It's ok in your program because searching for matches is the main thing you are doing. Otherwise, move up the closing paren (currently, the parens in the regex serve no purpose at all) to the end, and use $1. Or remove the parens, add a /g, and capture the return value in list context. Or use Regexp::Common and /$RE{URI}{HTTP}{-keep}/ and $1.

Abigail

  • Comment on Re: Extract substring from string with no whitespace using regexp?