Jump to content

What's the expression for alpha numeric?


aeroswat

Recommended Posts

/[^0-9a-z]/i

@neil - your A-z will allow all characters between Z and a in the ASCII table too

 

I think there are no characters between cap A and cap Z on the ASCII table? And I need it to be able to recognize both lowercase and uppercase if that makes a difference.

My regex does...and yes there are

http://www.asciitable.com/

 

There are between cap Z and low a but not between cap A and cap Z. So I'm seeing this on some sites... would this do what I want it to?

 

/[^0-9A-Za-z]/

 

I want to use ur example Jay but I would think that it is case sensitive and being a ISBN there will mostly be capitals unless the person is too lazy to put caps

oops. Thats what I meant. Yes it will although I don't see what was wrong with my regex? it was case insensitive (hence the i after the /) so it does the same thing

 

Sorry I didn't know what the /i meant. I don't know much about reg expressions at all. So would this be what i would do to remove all of the non a-z's and 0-9's

 

preg_replace("/[^0-9a-z]/i", "", $bookISBN)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.