Back to API Reference
Interface

IParseRule

abstract

Interface for custom text parsing rules that identify modifier application ranges.

Remarks

Parse rules scan text for markup (XML tags, Markdown, custom markers) and produce ParsedRange entries that specify where modifiers should be applied. Rules are matched in priority order (highest first). Use higher priority for explicit markup rules (tags, Markdown) and lower priority for auto-detection rules (raw URLs).
public int Priority{ get }

Gets the matching priority. Higher values are matched first. Default is 0. Use positive values for explicit markup, negative for auto-detection.

public bool IsStandalone{ get }

Indicates whether this rule operates without a modifier (e.g., protection rules like noparse). When, the rule can be registered via UniText.RegisterRule without pairing it with a BaseModifier.

public abstract int TryMatch(ReadOnlySpan<char> text, int index, PooledList<ParsedRange> results)

Attempts to match a pattern starting at the specified index.

public virtual void Finalize()

Called after parsing completes to finalize any pending ranges (e.g., unclosed tags).

public virtual void PostParse()

Called after tag stripping to add ranges in clean-text space.

public virtual void Reset()

Resets the rule state for a new parse operation.

See Also

TagParseRuleAttributeParser