What I have gathered till now:
- ^ -> match the first symbol
- $ -> match the last symbol
- [] -> set of characters that can be in the position
- | -> the "OR" operator
- ? -> the previous condition is optional
What I think the pattern means:
The line has to either begin with an a or a b or has to end with a c or has to be an empty string. I am having trouble drawing the dfa for the pattern though. What's throwing me off is the "optional" symbol. I am not able to understand what strings won't be accepted in the language.
Can someone point me in the right direction?
^matches the start of the line.[ab]?matches "a", or "b", or nothing.c?matches "c", or nothing.$matches the end of the line.So, I think these lines will match: