Click here to Skip to main content
15,891,907 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Generically i need to allow numbers and spaces some special charcters +,-,{ } only and min 7 to max 13 digits

Validation expression:
JavaScript
/^[- +()0-9]{7,13}$/


But Remaing special charters like $%^&*#@ allowed in textbox while typing I don't want

this.Please help me.


Thank you

What I have tried:

Validation expression:<pre lang="Javascript">/^[- +()0-9]{7,13}$/


But Remaing special charters like $%^&*#@ allowed in textbox while typing I don't want

this
Posted
Updated 31-Mar-20 10:38am
v2
Comments
ZurdoDev 31-Mar-20 14:08pm    
There are online regex generators. Have you tried one of those?
Ramesh p 31-Mar-20 14:22pm    
that is online expression but not worked
Kris Lantz 31-Mar-20 15:33pm    
It looks like similar has been asked before, with a potential modifiable solution here (Solution 4.) https://www.codeproject.com/Questions/720667/How-to-restrict-special-characters-and-spaces-in-t

1 solution

Quote:
There are online regex generators. Have you tried one of those?

Just a few interesting links to help building and debugging RegEx.
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
RegExr: Learn, Build, & Test RegEx[^]
Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx: Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]
This site also show the Regex in a nice graph but can't test what match the RegEx: Regexper[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900