On Thu, Aug 10, 2000 at 11:12:28AM +0200, Johan Vromans wrote:
> Of course, we need group names (trivial), and group temporaries.
> I needed the latter to define a generic pattern to match quoted strings:
> you need to store the starting quote somewhere to find the ending quote,
> but I didn't want this to have impact on the pattern as a whole. E.g.,
> 
>    $qp = qr/((['"]).*?\2)/;
>    @a = $str =~ /$qp/g;
> 
> and have @a contain only the quoted strings, and not (also) the individual
> quotes.

 $quoted = qr/(['"]).*?\2/;
 @a = $str =~ /($quoted)/gp;

Here //p is the "postponed" flag.  Put (?p{$quoted}) instead of
$quoted to get this semantic now (or some other char).

Ilya

Reply via email to