Skip to content

Main content

Delimiter Overlap Prefix Length Tool

Find the longest suffix of one literal delimiter that is a prefix of the next, measured in UTF-16 units.

Loading tool…

Description

Find the longest suffix of one literal delimiter that is a prefix of the next, measured in UTF-16 units.

Parsing depends on the chosen grammar, character encoding, offset unit, and treatment of escapes and delimiters. UTF-16 code-unit positions, Unicode code points, and UTF-8 byte offsets are not interchangeable. A boundary or token check supplies one part of a parser rather than validating an entire file.

Find the longest suffix of one literal delimiter that is a prefix of the next, measured in UTF-16 units.

When to use this tool

Use Delimiter Overlap Prefix Length when you need the stated token boundary, offset, prefix, delimiter, or count component inside a larger parsing workflow.

How to use the tool and how it works

  1. Enter leftDelimiter, rightDelimiter. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read overlapLength, overlap. Use the output convention below.

Find the largest length for which leftDelimiter ends with the corresponding prefix of rightDelimiter. Return overlapLength and that shared prefix.1

Input fieldMeaning and unitsAccepted input
leftDelimiterLeft DelimiterRequired. Text; maximum UTF-16 length 8192.
rightDelimiterRight DelimiterRequired. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
overlapLengthOverlap LengthRequired. Safe integer.
overlapOverlapRequired. Text; maximum UTF-16 length 8192.
json
{
  "input": {
    "leftDelimiter": "abcab",
    "rightDelimiter": "abx"
  },
  "output": {
    "overlapLength": 2,
    "overlap": "ab"
  }
}

Limitations and assumptions

  • Matching uses exact UTF-16 string operations and may split surrogate pairs. Empty strings give zero overlap; no token stream, escape handling, or grammar ambiguity is analyzed.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Choose a parser for the intended complete grammar when context, nesting, encodings, or semantic validation matters. Keep byte, code-unit, and code-point coordinates explicit when combining results.

References

  1. Calculation and input contract: parse/delimiter-overlap-prefix-length — tool.io

Similar or alternative tools