0

What exactly is this regex checking:

/^[0-9a-zA-Z]+[0-9A-Za-z'\-\.\s]{2,30}$/

Im looking for a string that can contain letters,numbers,spaces,periods,apostrophes, and dashes.

What does the first closure plus second closure mean? [..]+[..]

somejkuser
  • 8,856
  • 20
  • 64
  • 130
  • `+` would repeat the previous token one or more times. – Avinash Raj Feb 18 '15 at 03:04
  • The regular expression matches an entire string, hence the beginning of string `^` and end of string `$` anchors. The first character class asserts that there will be and matches any word character except an underscore at the beginning of the string "one or more" times. The second character class matches the same as the first with the exception of allowing these characters `'.-` and whitespace as well limiting it from **2** to **30** characters. – hwnd Feb 18 '15 at 03:07

0 Answers0