Would anybody please help generate a regular expression to be validated using javascript ? This regular expression should validate alphanumerical values in addition to the following set of characters:
{. - / \ ( ),'}_ + : ? ® © T
Thanks and best regards..
Would anybody please help generate a regular expression to be validated using javascript ? This regular expression should validate alphanumerical values in addition to the following set of characters:
{. - / \ ( ),'}_ + : ? ® © T
Thanks and best regards..
Share Improve this question edited Jul 3, 2013 at 1:08 Alan Moore 75.3k13 gold badges107 silver badges161 bronze badges asked Jul 1, 2013 at 20:50 Mostafa MoatassemMostafa Moatassem 3513 gold badges11 silver badges23 bronze badges1 Answer
Reset to default 8Sounds like you want a pattern like this:
^[\w{./\\(),'}+:?®©-]+$
Important things to note:
^
and$
match the start and end of the string, respectively, meaning that only these characters are allowed.[
and]
define a character class, which matches any of the characters defined inside the brackets\w
matches any alphanumeric character or underscore.- I omitted
T
and_
from the character class they are allowed by\w
. \\
is needed to escape the backslash, because that's a special character in regular expressions.-
must e at the beginning or end of the character class or else be escaped. Otherwise, it would mean something likea-z
any characters betweena
andz
.- Many other characters here have special meaning within regular expressions (e.g.
?
,+
, and()
), but it's not necessary to escape them within a character class. - The
+
on the end means that one or more of these characters is allowed.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742295777a4417086.html
评论列表(0条)