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

$b = index(lc($mystr),"a");
  • Comment on Re: How can I find the first position of a substring case-insensitively?
  • Download Code

Replies are listed 'Best First'.
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

    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));