Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
^(?![ -.&,_'":?!])(?!.*[- &_'":]$)(?!.*[-.#@&,:?!]{2})[a-zA-Z0-9- .#@&,_'":.?!]+$
/
gm

Description

Used to validate entries like Address names and cities, streets.

  • Allows any of the following characters -.#@&,:?!]{2})[a-zA-Z0-9- .#@&,_'":.?!
  • Prohibits these characters from begining a sentence -.&,_'":?!
  • Prohibits these characters from ending a sentence - &_'":
Submitted by Sowed castelli - 3 years ago