Link to home
Start Free TrialLog in
Avatar of static86
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?
Avatar of kaufmed
kaufmed
Flag of United States of America image

Which engine/language are you using? I am not familiar with that syntax for OR expressions.
ASKER CERTIFIED SOLUTION
Avatar of Terry Woods
Terry Woods
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of static86
static86

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:/
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Actually, punctuation may not be of concern for this problem. I don't know what your valid inputs are, though.