Home » Web Development » 05 - Client Side Scripting Concepts
5

Shorthands

Summary of shorthand or shortcuts in javascript

. Matches any character
\w Matches all letters (lowercase and uppercase), numbers, and the underscore(_)
\s Matches any whitespace character including carriage return. tabs, vertical tabs etc.
\S Matches any nonwhitespace character
\d Matches digits 0-9
A-Z Matches all characters in interval A-Z (hyphen stands for interval). Essentially, the hyphen indicates an interval. a-e matches a,b,c,d, or e.
a-z Matches all lowercase alphabets
^ Signifies the start of the string that is being searched. For example ^a would match the 'a' in 'apples are good for you' but not the 'a' in 'i like apples'
$ Signifies the end of the string that is being searched.