C
Calum MacLean
I have a sequence of "objects" which must occur in a certain order, with
optional items etc.
As I've been using regex's quite a bit of late, it struck me that it might
be useful to do a similar thing for arbitrary objects, rather than just for
text characters.
For example, if I have objects A, B, C, D and E, and:
they must occur in the sequence in that order (if present)
B is optional
exactly one of D and E must be present.
then it would be nice to be able to specify this as "AB?C[DE]" - or
something equivalent.
Does this make sense? Do you know if there are any libraries available to
allow you to do this sort of thing?
Thanks,
Calum
optional items etc.
As I've been using regex's quite a bit of late, it struck me that it might
be useful to do a similar thing for arbitrary objects, rather than just for
text characters.
For example, if I have objects A, B, C, D and E, and:
they must occur in the sequence in that order (if present)
B is optional
exactly one of D and E must be present.
then it would be nice to be able to specify this as "AB?C[DE]" - or
something equivalent.
Does this make sense? Do you know if there are any libraries available to
allow you to do this sort of thing?
Thanks,
Calum