Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: regex problem

by robartes (Priest)
on Jun 08, 2005 at 09:41 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://464614]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-04-23 13:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found