Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Answer: How can I find the first position of a substring case-insensitively?

by cogent (Monk)
on Dec 06, 2000 at 00:49 UTC ( [id://45082]=note: print w/replies, xml ) Need Help??


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

It's kind of a pain in the butt, but here's one way:

my $haystack = "foobar"; my $needle = "Bar"; $haystack =~ /($needle)/gi; print ((pos $haystack) - (length $needle));
  • Comment on Re: Answer: How can I find the first position of a substring case-insensitively?
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-23 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found