in reply to a regex

What input data are you validating here? That regex might be adequate for a user name field, though it's a bit restricting. It's useless for a message field.

If you're worried about text messages, you should be encoding to HTML entities any strange characters, in the first place. E.g., save the message to the database (unless it's judged to be too long or there's some other reasonable objection to prevent form submission), and when you go to display it, make use of HTML::Entities. (This ignored any long-line issues, which you can solve by inserting spaces or soft hypens).

Replies are listed 'Best First'.
Re^2: a regex
by toniax (Scribe) on Dec 13, 2010 at 19:43 UTC
    good Idea
    I already had plans to add the database to the second version of my program.
    A database is not an option on my first version.
    Thanks for the link
    -X-