LOGBOOK

HELP

Quiz Entry - updated: 2026.11.26

What does the regular expression /\w*((\%27)|(\'))((\%6F)|o|(\%4F))((\%72)|r|(\%52))/ix match?

A single quote (literal or URL-encoded %27) immediately followed by the word "or" in any case or encoding: the core of a ' or … SQL injection.

Paths through the quote-then-or regex

* Each step accepts the literal character or its URL-encoded forms, so many spellings reach the same match. *

Reading it piece by piece:

  • \w*: zero or more word characters (letters, digits, underscore). Because it can be empty, it adds nothing to the match.
  • ((\%27)|(\')): the single quote, either encoded as %27 or literal '.
  • ((\%6F)|o|(\%4F)): the letter o as o, %6F (lowercase) or %4F (uppercase).
  • ((\%72)|r|(\%52)): the letter r as r, %72 or %52.
  • ( … ) groups alternatives; | means OR.
  • Modifiers: i ignores case, x ignores whitespace in the pattern (so it can be written readably).

So it fires on 'or, 'OR, %27or, %27%4F%52 and so on. It detects the injection shape rather than one fixed string, which is why it is in a pcre option instead of a content. It comes from a well-known 2004 Black Hat paper on detecting SQL injection and XSS with Snort, whose rules carry over to Suricata almost unchanged.

Go deeper:

From Quiz: ISLAB / Network Security Monitoring | Updated: Nov 26, 2026