toktik
toktik

Reputation: 1957

Regex which contains only numbers and some characters

I need regex which contains only 0-9 numbers and the following characters: -,+,# (but not required)

How should this be?

Upvotes: 2

Views: 11620

Answers (2)

Teej
Teej

Reputation: 12873

This should work with what you're looking for

/[0-9+#-]/ 

fixed as per comment below

Upvotes: 7

How about ([0-9]|[\-+#])+?

Upvotes: 5

Related Questions