Perl: the Markov chain saw | |
PerlMonks |
Pattern match location findingby feloniousMonk (Pilgrim) |
on Feb 18, 2004 at 19:59 UTC ( [id://330034]=perlquestion: print w/replies, xml ) | Need Help?? |
feloniousMonk has asked for the wisdom of the Perl Monks concerning the following question:
Hello all Can anyone think of a fast way to do exact pattern matching and report back the actual match location within a string? Ex., if I have a string "AABAABBBB", and my query string is "B", I would like to return a list of "B" occurences in the target string (3, 6, 7, 8, 9). Currently I am walking through the target string with substr() calls, I know there's got to be a faster way to do this. Oh yeah, I didn't post code because I don't want code critique, etc., just looking for concepts.
Thanks, felonious --
Back to
Seekers of Perl Wisdom
|
|