Interface CanReorderOptions

Options to control the behavior of canReorder.

Hierarchy

  • CanReorderOptions

Properties

ignoreCapturingGroups?: boolean

Capturing groups are typically referenced by their position, so they cannot be reordered without affecting the behavior of the regular expression.

However, in some cases capturing groups and their order doesn't matter. Enabling this option will allow all permutations that change the order of capturing groups.

Default

false
matchingDirection?: OptionalMatchingDirection

The matching direction of the alternatives.

The correctness of canReorder depends on this direction being correct.

If the matching direction cannot be known, supply "unknown". "unknown" is guaranteed to always create a correct result regardless of matching direction. If canReorder returns true for "unknown", then it will also return true for both "ltr" and "rtl" and vise versa.

This value defaults to the result of getMatchingDirection for any of the given alternatives.