static86
asked on
regex - value a or nothing
Hi,
I know that {a, b, c} represents a or b or c.
How can I write regular expression for to accepts sentences "I passed" and "I had passed".
Is it just {a} or {a, ""} or something different?
I know that {a, b, c} represents a or b or c.
How can I write regular expression for to accepts sentences "I passed" and "I had passed".
Is it just {a} or {a, ""} or something different?
Which engine/language are you using? I am not familiar with that syntax for OR expressions.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
well, i'm not sure what it is, this is part of my homework and these are details which I got:
( and ) are for grouping
* means any number of occurrences (including none)
+ means at least one occurrence
? means at most one occurrence
{a, b, c} represents a or b or c
@ matches any word or part of speech
a,b,c means a followed by b followed by c
I think it is something like: I ?{a} passed, but I'm not sure:/
( and ) are for grouping
* means any number of occurrences (including none)
+ means at least one occurrence
? means at most one occurrence
{a, b, c} represents a or b or c
@ matches any word or part of speech
a,b,c means a followed by b followed by c
I think it is something like: I ?{a} passed, but I'm not sure:/
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Actually, punctuation may not be of concern for this problem. I don't know what your valid inputs are, though.