Pure.Krome
Pure.Krome

Reputation: 86957

How can I write a regex to exclude both alphanumeric characters and spaces?

I have the following regex pattern, which strips out non, alpha-numerics.

[^0-9A-Za-z]

Works pretty good.

I was hoping to mod this regex so it looks for alphanumerics AND spaces. How can I tweak it so it also accepts spaces?

Upvotes: 2

Views: 4326

Answers (1)

JaredPar
JaredPar

Reputation: 754735

Put a space into the brackets

[^0-9A-Za-z ]

You're question is also slightly ambiguous. I'm assuming you're looking to exclude both alphanumerics and spaces.

Upvotes: 10

Related Questions