Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

RegEx Pattern to Match Only Certain Characters

The dash needs to be first in order not to be interpreted as a range separator. Also, make sure you anchor your regex with a ^ and $ at the beginning and end respectively so that your entire test string gets swallowed by your regex.

/^[-+., A-Za-z0-9]+$/

I just tested this out, and it seems to work at least from my first round testing.

^[a-zA-Z 0-9\.\,\+\-]*$

Tags:

Javascript

Regex

Related

How do I do redo (i.e. "undo undo") in Vim? How to convert an address from IPv4 to IPv6 When is finally run if you throw an exception from the catch block? Can ImageMagick return the image size? Java Class.cast() vs. cast operator Calculating the difference between two Java date instances How to make an autocomplete address field with google maps api? Why is Gmail blocking CSS in emails? Sending email with gmail smtp with codeigniter email library How to stop EditText from gaining focus at Activity startup in Android How to save a model without sending a signal? How to fix error: The message received from the server could not be parsed

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy