I have searched within SO and found out several regular expressions to be used to include ONLY THESE a-z A-Z 0-9 - _
. So far what I have tried was this one, /[^a-zA-Z0-9_ %\[\]\.\(\)%&-]/s
. What this actually did was it did not exclude brackets {} []
and parenthesis ()
. I am not very experienced with regex
, heck I don't fully fathom the whole meaning, structure/format of it so can somebody provide me the exact regex
which I am looking for? Thanks for the time.
Asked
Active
Viewed 8,241 times
1

Tsukimoto Mitsumasa
- 541
- 4
- 19
- 42
-
1Another `-1` for profanity. Being new to something does not exempt you from doing a [bit of research](http://regexp.info/). – mario Jun 18 '14 at 13:46
-
1Yeah, thank you captain obvious. – Tsukimoto Mitsumasa Jun 18 '14 at 13:46
-
possible duplicate of [regular expression for letters, numbers and -](http://stackoverflow.com/q/3028642) – mario Jun 18 '14 at 13:49
-
1@mario - You probably mean 'thoroughness'? 'Profanity' is not the noun of 'being profound'. – Frank Conijn - Support Ukraine Jun 18 '14 at 16:36
2 Answers
6
Here it is :
^[a-zA-Z0-9_-]{1,}$
Will check Any word of at least one letter, number , _ or -
Here is the tutorial for basic REGEX.

Harshal
- 3,562
- 9
- 36
- 65
-
2
-
It is up to him , how he want to use regex. i have explained only for 1 limit. – Harshal Jun 18 '14 at 14:07