Numbersflags: g

Octal Number Literal

Match modern ECMAScript-style octal literals (`0o755`) — strict per ES6+ syntax.

Try it in RegexPro →

Available in

Pattern

regexengine-agnostic
\b0[oO][0-7]+\b   (flags: g)

Raw source: \b0[oO][0-7]+\b

How it works

\b is a word boundary. 0[oO] requires the modern ES6 octal prefix (case-insensitive on the o). [0-7]+ matches one or more octal digits (0–7). \b prevents matching into adjacent letters. Note: the loose `0755` form (no o) is technically a legacy octal in some languages but is dangerous in JS strict mode — this pattern requires the explicit `0o` prefix.

Examples

Input

perms = 0o755; mask = 0o022

Matches

  • 0o755
  • 0o022

Input

fileMode := 0o644

Matches

  • 0o644

Input

no octal

No match

Common use cases

  • Source-code analysis for file-mode literals
  • Unix permission detection in IaC code
  • Linting against deprecated octal forms
  • Educational / tutorial parsing

Related patterns