MEPX
Chapter 8 of 10All chapters

Chapter 8 of 10

Flags

Changing how the whole pattern behaves.

The common ones

Ignore case, multiline so anchors apply per line, dot-all so the dot also matches newlines, and global so every match is found rather than the first.

  • Global is a property of the search in some languages and of the pattern in others.
  • A stateful global regex object can surprise you by resuming from where it stopped.

Unicode

Turning on Unicode mode changes what counts as a word character and lets you match by script or property, which matters for any text beyond English.