in reply to Need regex to check for disallowed characters

perldoc perlre

You could also try posting what you have tried and has failed and let us monks have somewhere to start...

  • Comment on Re: Need regex to check for disallowed characters

Replies are listed 'Best First'.
Re: Re: Need regex to check for disallowed characters
by imlou (Sexton) on Apr 09, 2004 at 19:43 UTC
    i've tried /(\W)*(\d)*(\s){2,}/ but because of the \W it ignores the \s{2,}. What i need is something that will allow only one space.

          What i need is something that will allow only one space.

      From perldoc perlre:

                 {n}    Match exactly n times 
                 {n,}   Match at least n times
                 {n,m}  Match at least n but not more than m times
       
      
      If you want to match exactly one space you could either use just \s or \s{1}.