Regular Expressions 101

Community Patterns

Browser Console - Format Specifier

1

Regular Expression
ECMAScript (JavaScript)

/
(?<!(?:[%]{2})*[%])[%][sidfoOc]
/
gm

Description

Captures format specifiers commonly used in logging and console messages, as defined in the current whatwg/console spec:

  • %s: Formats the value as a string
  • %i: Formats the value as an integer
  • %d: Formats the value as an integer
  • %f: Formats the value as a floating point value
  • %o: Formats the value as an expandable DOM element. As seen in the Elements panel
  • %O: Formats the value as an expandable JavaScript object
  • %c: Applies CSS style rules to the output string as specified by the second parameter
Submitted by anonymous - 3 years ago