Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am using the following code to verify a string
if ( $subject !~ /^[a-zA-Z1-9.]+$/ ) {
The field i am checking could be eg.. this is the day (Is there a way in the above code to allow a space) Any help would be appreciated

Updated Steve_p - added code tags

Replies are listed 'Best First'.
Re: Allow a space in string verification
by Roy Johnson (Monsignor) on May 09, 2005 at 22:46 UTC
    Have you tried sticking a space in your character class?

    Caution: Contents may have been coded under pressure.
Re: Allow a space in string verification
by sh1tn (Priest) on May 09, 2005 at 23:11 UTC
      sh1tn Thanks for your reply, i had tried using a space ,litterally, rather than space. All working ok now. Thanks again
Re: Allow a space in string verification
by tlm (Prior) on May 09, 2005 at 23:56 UTC

    I find it curious that you don't include 0 (a fine numeral) in your character class. I realize that there are cases in which even a digit of impeccable credentials such as 0 may not be welcome while others are, but your regexp doesn't look like one of those situations.

    the lowliest monk