Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: subroutine within regex quantifier?

by chromatic (Archbishop)
on Dec 04, 2001 at 09:39 UTC ( #129268=note: print w/replies, xml ) Need Help??

in reply to subroutine within regex quantifier?

There's the experimental (?{...}) construct, but I can't think of a way to use that. Why not use length and a slightly different regex?
while (length($target_letters) != WORD_LENGTH && $target_letters =~ /[^A-Za-z]/) { # prompt }
Seems clearer to me, as well as *possible*.

Replies are listed 'Best First'.
Re: Re: subroutine within regex quantifier?
by hagen (Friar) on Dec 04, 2001 at 10:26 UTC

    Thanks chromatic, that is clearer and `feels' more Perl-like. I got fixated on having to use the quantifier.


    I also appreciate dws's suggestion re compiling only once.

    Thanks for the prompt responses

    hagen 8-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://129268]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2021-05-09 14:43 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (100 votes). Check out past polls.