Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: How can I find the first position of a string within a string

by chipmunk (Parson)
on Dec 01, 2000 at 19:46 UTC ( [id://44380]=note: print w/replies, xml ) Need Help??


in reply to How can I find the first position of a substring case-insensitively?

How about a regex?
if ($mystr =~ /(?=a)/gi) { $position = pos($mystr); }
I use a positive lookahead assertion so that pos() will correspond to the start of the match, rather than the end.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-19 13:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found