Jump to content


Photo

How would i...


  • Please log in to reply
2 replies to this topic

#1 Chevy

Chevy
  • Members
  • PipPipPip
  • Advanced Member
  • 163 posts

Posted 02 August 2006 - 11:02 PM

How would I got about banning spaces?

if (!ereg ("([0-9a-zA-Z_])", $username)) {

thats all I want to allow is 0-9, a-z, A-Z and _'s....but spaces somehow find there way threw....can you help me?

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 03 August 2006 - 04:47 AM

You didn't use anchors.
!preg_match('/^\w+$/', $string)

Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#3 Chevy

Chevy
  • Members
  • PipPipPip
  • Advanced Member
  • 163 posts

Posted 03 August 2006 - 04:49 PM

Oh yeaa :D Thanks a lot!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users