Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Regex Question

by Ratazong (Monsignor)
on Nov 26, 2012 at 08:30 UTC ( #1005589=note: print w/replies, xml ) Need Help??


in reply to Re: Regex Question
in thread Regex Question

Your index won't work in case there is an a before the third position, e.g. in the string aba. If you (really) want to use index, use the 3-argument-form instead:
$x = "aba"; print "$x\n" if index($x, "a", 2) == 2;
HTH, Rata

Replies are listed 'Best First'.
Re^3: Regex Question
by kcott (Chancellor) on Nov 26, 2012 at 08:43 UTC

    ++ Thanks Ratazong. You're absolutely correct. I've updated my node.

    -- Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005589]
help
Chatterbox?
LanX LOLs
[perldigious]: If you want a linguistic adventure...
[perldigious]: No offense to any Scotsman, I love Scots. Well actually, I love Scotch, but I'm sure the people are great too. :-P
[Discipulus]: perldigious i understand i word on ten, to be optimistic..
LanX will try to give his next LPW talk with a Cogney intonation
[Discipulus]: if you love Scotch in scotland your safety will be.. glengranted
[LanX]: *Cockney

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2017-06-23 16:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (552 votes). Check out past polls.