in reply to Re^3: doubt in string matching.
in thread doubt in string matching.

Sorry but unless you perform a check at each increment, this incrementing does not prove good. Your implementation just checks the first and last characters only. This will return success if
$find = "CDED"; # or $find = "CDEH"; # or $find = "CDEJ"; #or even $find = "CDEC";
Also if you check the pattern closely,
BCDEFGHIJKLMNOPCDEFQRST
you can find a CDEF in-between the P and Q. So incrementing the string from $first..$last should not be the approach here.
I believe by "incrementing" what OP meant was incrementing the search string from first to last position. Thanks..

Replies are listed 'Best First'.
Re^5: doubt in string matching.
by prasadbabu (Prior) on Oct 17, 2006 at 06:59 UTC

    Mandrake You are absolutely correct, but OP has not given enough samples of input and he has not given the exact requirement clearly, which I mentioned in my first reply itself and the samething was highlighted by ikegami and chargrill. So I assumed he might have inputs with incremented characters inbetween instead of random characters.

    ikegami has mentioned

    We can't help you if you can't even describe what you want accuratly

    chargrill has mentioned

    I don't know what you mean. Solid examples will speak volumes, show us what output you want to get.

    Prasad