Regex Flag Set Audit

Audit syntactic ECMAScript flag names, duplicates and mutually exclusive u/v flags; does not assert every flag is supported by the installed runtime.

Description

Audit syntactic ECMAScript flag names, duplicates and mutually exclusive u/v flags; does not assert every flag is supported by the installed runtime.

Regex flag strings can contain duplicates, unsupported characters or mutually exclusive Unicode modes. These conditions are independently useful to report.

When to use this tool

Audit syntactic ECMAScript flag names, duplicates and mutually exclusive u/v flags; does not assert every flag is supported by the installed runtime.

  • Prepare the supplied flags fields for this operation.
  • Compare the complete example with the representation used by your own input before carrying the result into another step.

How to use the tool and how it works

  1. Enter flags. Use the exact text syntax, units and index conventions explained below.
  2. Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
  3. Read result.valid, result.duplicates, result.unknown, result.unicodeConflict. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Accept the declared flag inventory dgimsuvy, group repeated characters with positions, list unknown characters and flag simultaneous u and v. valid requires none of these issues.1

Input fieldMeaning and representationAccepted input
flagsflags.Text; at most 8,192 UTF-16 code units, subject to the grammar above
Output fieldInterpretation
resultObject containing the named outputs below.
result.validFlag for valid under the exact condition described above.
result.duplicatesThe duplicates list in the ordering and representation described above.
result.unknownThe unknown list in the ordering and representation described above.
result.unicodeConflictFlag for unicode conflict under the exact condition described above.
json
{
  "input": {
    "flags": "gguvx"
  },
  "output": {
    "result": {
      "valid": false,
      "duplicates": [
        {
          "key": "g",
          "indexes": [
            0,
            1
          ]
        }
      ],
      "unknown": [
        "x"
      ],
      "unicodeConflict": true
    }
  }
}

Limitations and assumptions

  • No pattern is compiled and local engine feature support is not tested. Passing this inventory check is not a regex performance or syntax guarantee.
  • All declared input fields are required and unexpected top-level fields are rejected. Numbers must be finite; lists are limited to 128 entries and ordinary text fields to 8,192 UTF-16 code units, with tighter limits where stated.
  • JSON text inputs must parse within bounded nesting and size limits. Numeric outputs outside the safe finite range are rejected; large exact integer results use decimal strings. Indexes and half-open spans are zero-based unless a rank is explicitly described as one-based.

Alternative or Complementary methods

Compile generated pattern sources with explicitly chosen flags and test them on bounded representative text. Pattern sources, replacement strings and JSON string spellings require different escaping conventions.

References

  1. Tool behavior and example: Regex Flag Set Audit — tool.io

Similar or alternative tools

  • Regex Capture Index Map

    Map ECMAScript capture indexes, names and opening-parenthesis UTF-16 positions after runtime syntax validation; escaped/class parentheses are ignored.

  • Literal Full Token Pattern Builder

    Build a literal full-string ECMAScript pattern with a strict end assertion, avoiding dollar-anchor final-newline acceptance; assumes no multiline flag.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies