Exclude a Pattern in regex When Matching Another Pattern #1249
-
Hello everyone, I have a question regarding the use of I am aware that within Character classes, the Is there any way to achieve this exclusion in Rust's Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
What you're looking for is a way to represent the "complement" of a regex. While that operation (along with intersection) is closed under regular languages, and this crate only supports patterns expressing a regular language, this crate does not support either (complement or intersection). You'll need to write out the complement yourself (which is often tricky and very large) or match a second regex (which isn't always possible depending on what you're doing, but usually is). |
Beta Was this translation helpful? Give feedback.
What you're looking for is a way to represent the "complement" of a regex. While that operation (along with intersection) is closed under regular languages, and this crate only supports patterns expressing a regular language, this crate does not support either (complement or intersection). You'll need to write out the complement yourself (which is often tricky and very large) or match a second regex (which isn't always possible depending on what you're doing, but usually is).