Skip to content

regex-cli: validate patterns before combining alternations#1367

Open
ayakamiki wants to merge 1 commit into
rust-lang:masterfrom
ayakamiki:martinzhang/regex-cli-validate-combined-patterns
Open

regex-cli: validate patterns before combining alternations#1367
ayakamiki wants to merge 1 commit into
rust-lang:masterfrom
ayakamiki:martinzhang/regex-cli-validate-combined-patterns

Conversation

@ayakamiki

Copy link
Copy Markdown

Fix a regex-cli bug where --combine-patterns could accept individually invalid patterns if joining them with | happened to produce a valid regex.

Make args::patterns::Config::get syntax-aware by validating each pattern with the current CLI syntax configuration before combining. This preserves support for syntax-dependent options such as --octal while rejecting misleading inputs earlier.

Also update regex-cli call sites to pass syntax config through and add focused tests for rejecting individually invalid patterns, accepting individually valid patterns, and respecting syntax configuration during validation.

Fix a regex-cli bug where --combine-patterns could accept individually invalid patterns if joining them with | happened to produce a valid regex.

Make args::patterns::Config::get syntax-aware by validating each pattern with the current CLI syntax configuration before combining. This preserves support for syntax-dependent options such as --octal while rejecting misleading inputs earlier.

Also update regex-cli call sites to pass syntax config through and add focused tests for rejecting individually invalid patterns, accepting individually valid patterns, and respecting syntax configuration during validation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant