Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Re: substring exists at particular postion?

by joealba (Hermit)
on May 23, 2002 at 13:11 UTC ( [id://168756]=note: print w/replies, xml ) Need Help??

in reply to Re: substring exists at particular postion?
in thread substring exists at particular postion?

What about this too (borrowing from hotshot's example):
my $bigStr = 'Once upon a time there was a little programer'; my $littleStr = 'time'; if ($bigStr =~ /^(.*?)$littleStr/) { my $position = length($1); print "Found $littleStr at position $position\n"; # Do whatever depending on the position returned }
Since you mentioned that you'd be looking for the string in more than one position, this will allow you to do the match once.

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-05-18 15:36 GMT
Find Nodes?
    Voting Booth?

    No recent polls found