Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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 chilling in the Monastery: (2)
As of 2020-02-24 07:06 GMT
Find Nodes?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?

    Results (104 votes). Check out past polls.