From the course: Learning Regular Expressions
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Shorthand character sets - Regular Expressions Tutorial
From the course: Learning Regular Expressions
Shorthand character sets
- Most regular expression engines allow us to use shorthand character sets. They can be very useful and save you some typing. If we use the back slash d in a regular expression it means any one digit. It's the equivalent of having a character set that has the character range zero through nine in it. Back slash w is a word character. That would be the equivalent of all the letters A to Z, both lowercase and uppercase. All numbers zero through nine, and the underscore you can see that's quite a bit less typing. And then back slash s is the shorthand for white space. That's not only a space like the space between words but it's also a tab or any kind of line return or line feed. There's also the negative version of each of those which you get by just capitalizing the letter back slash capital D back slash capital W, back slash capital S. In the case of back slash D it would be anything that's not a digit so it's any one…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.