5 ms·
I may add synonyms for those classes, so, it is just a matter of adding: Repeat = Times etc. you wouldnt use these structures in python code, you use them to
by iogf 9y ago
I may add synonyms for those classes, so, it is just a matter of adding:
Repeat = Times
etc.
you wouldnt use these structures in python code, you use them to build your regex then compile it and use the regex in your programs. It is possible to add some type safety and messages to help debugging which would be better than with natural regex syntax.
- iogf 9y agoSeq stands for a-z or 0-9 which can be used only in Include and Exclude. When you write Include(Seq('a', 'm')) it means you are including a character from that sequence in a given position of your pattern. So if you have Pattern(Include(Seq('a', 'm')), 'c') That is sort of building the following set of strings. ac bc cc . . . When you use Exclude, it would be like you are picking a char that is not belonging to the sequence, like in: Pattern(Exclude(Seq('0, 9')), c) then you would end up with a set like: ac bc cc . . . It means, a set whose first character of the elements arent digits.
- masklinn 9y agoSeq is odd, to me Seq('a', 'm') says it matches 'am'. Why not overload X to support filtered forms instead? E.g X() is ".", X(from_, to_) is $from-$to, X(items) is [$items] and X(exclude) is [^$items]?
- iogf 9y agohmm, I think it is good, maybe p0 = X('a', 'z'). I like it.
- masklinn 9y agoPlus then you get to more add convenient overloads e.g. (X('a') | X('z')), (~X('q')), X[1:7] (I guess slices would be ranges, and indexes would be explicit numbers of repetitions), etc…
- iogf 9y agoI think so i would ask you to open issues in crocs at github, so i can better keep track of suggestions and implement them.