Literal Matching
The simplest regex pattern matches text literally, character by character.
Exact Matches
The pattern hello matches exactly those five characters in that order.
Notice how:
hellomatches insidehellooo(the first 5 characters)- Each occurrence is found with the
g(global) flag
Case Sensitivity
By default, regex is case-sensitive.
Multiple Occurrences
With the g flag, all matches are found:
Matching Phrases
You can match multiple words too:
Practice
Try matching:
quick- appears twicethe- case sensitivejump- find both jump and jumps
Key Takeaways
- Literal patterns match exact text
- Case matters by default (use
iflag to ignore) - The
gflag finds all occurrences - Spaces and punctuation are characters too

