2

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?

1 Answer 1

10

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.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks mate. I've got some sql udf that returns a string, with all non-alphanumerics stripped out. I wanted to make it strip out everthing BUT alpha/numberic/spaces. (and i replace all spaces with a '-' character). works great. thanks. (DB is sql2008, btw).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.