in reply to Regex help

You can't, from the server side, control what the user enters into the TEXTAREA field.

If all you want to do is trim the string to be 1100 characters at most, just do this:

use constant MAX_CHARS => 1100; if ( length($str) > MAX_CHARS ) { $str = substr( $str, 0, MAX_CHARS ); }
update: As a later reply points out, the length test is not necessary. If you don't want to do the test, at least point out WHY it is that you're calling substr.
# Limit the string's length $str = substr( $str, 0, MAX_CHARS );

xoxo,
Andy

%_=split/;/,".;;n;u;e;ot;t;her;c; ".   #   Andy Lester
'Perl ;@; a;a;j;m;er;y;t;p;n;d;s;o;'.  #   http://petdance.com
"hack";print map delete$_{$_},split//,q<   andy@petdance.com   >

Replies are listed 'Best First'.
Re: Re: Regex help
by MeowChow (Vicar) on Jun 15, 2001 at 20:46 UTC
    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