in reply to how to search for a pattern in a string within a certain range

Apart from Ikegami's suggestion, you might also reduce your string to its first 8 or 11 characters (*) and then apply your pattern-matching on the reduced string. Use substr for reducing the string.

* depending whether the TTT needs to be contained in the 8 characters or not

  • Comment on Re: how to search for a pattern in a string within a certain range

Replies are listed 'Best First'.
Re^2: how to search for a pattern in a string within a certain range
by moritz (Cardinal) on Mar 08, 2010 at 07:41 UTC
    you might also reduce your string to its first 8 or 11 characters (*)

    8 or 10 please.

    If the substring has to start within the first 8 characters, it can only extend 2 two character over the first 8. A typical Off-by-one error :-)

    Perl 6 - links to (nearly) everything that is Perl 6.