in reply to Re: Regex help
in thread Regex help

The length tests on this and most of the other answers in this thread are unnecessary. As the documentation for substr states:
If OFFSET and LENGTH specify a substring that is partly outside the string, only the part within the string is returned.
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print