Skip to the content.

#Regular Expressions

-

What we’ll cover

-

Resources

-

Regex basics

-

Basic symbols

-

Dot matching

. - matches any one character

-

Repeated matches

-

Repeated matches (continued)

-

Advanced Matching

-

Boundaries

-

Character classes

-

Predefined character classes

Shortcuts for commonly used character classes

-

Using Regex in Java

-

Quirks

-

Methods and Classes

-

Examples

public boolean batman(String str){
  return str.matches("(na){16}");
}
public boolean manOfSteel(String str){
  return str.matches("(Clark Kent)|(Superman)|(Kal-El)");
}
public boolean time(String str){
  return str.matches("w[io]bbly");
}

-

Backtracking

-

Lazy quantifiers

AKA Reluctant quantifiers

-

cute bats