Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: regex problem

by robartes (Priest)
on Jun 08, 2005 at 09:41 UTC ( #464614=note: print w/replies, xml ) Need Help??


in reply to regex problem

You're probably looking for something along these lines:

/^If[^f]/ # If followed by anything that is not f

The regex /^If?/ matches both your cases because you're looking for I followed by 0 or more 1 f's, so even Ig would match. The /^If{1}/ also matches both because both strings start with If, i.e. I followed by exactly one f. The second string has an additional f, but that particular regex is not concerned about that.

Update: rev_1318 is right, of course (see this node)

CU
Robartes-

Replies are listed 'Best First'.
Re^2: regex problem
by rev_1318 (Chaplain) on Jun 08, 2005 at 10:20 UTC
    The regex /^If?/ matches both your cases because you're looking for I followed by 0 or more f's

    Actually, that's 0 or 1 f's, not 0 or more :) (but who's counting)

    Paul

Re^2: regex problem
by mosh (Scribe) on Jun 08, 2005 at 09:59 UTC
    Thanks for the detailed explanation !

    Mosh.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://464614]
help
Chatterbox?
[ELISHEVA]: \Disciplus : lol
[Discipulus]: and ELISHEVA we waait one your post since ~2years... ;=)
[ELISHEVA]: has it really been that long?
[Discipulus]: it seems..
[Discipulus]: more: just one thread in the last ~5 years
[Discipulus]: but Dumas is waiting for me in the bed.. luckly as book author.. see you!
[ELISHEVA]: Sleep well!
[ELISHEVA]: Or read well
[Discipulus]: thanks, best dreams to you all

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2017-05-28 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?