I am looking for a regex to create a DFA that contains all the words except one.
All possible terms except words containing the alphabet = {X, y, z} word = xyz Example:
Valid: xyyzx yyxzyxz yyzzx
invalid: x xyz z yxz xyz xyz Yxz
thanks
You can take advantage of abandonment techniques by using a regex like this:
[xyz] * xyz [xyz] * | ([Xyz] +)
The idea behind this regex matches invalid data , But to capture important data.
Match information is:
Matches 1 1. [7 -12] `xyyzx` match 2 1. [13-20]` Yuxxx` match 3 1. [21-26] `Xxxx`
As you can see, you have to capture the contents of the capturing group to get valid data.
In discard techniques, except for all patterns, the pipes (regex "or") are made to the left of the reagents separated, but using the capturing group in the correct pattern Therefore, for this regex:
[xyz] * xyz [xyz] * | ([Xyz] +) Leaving the lease - ^ ^ --- Keeping this pattern
No comments:
Post a Comment