2017-09-03

HW01 BNF Regex Error.

I believe there is an error in the regex for HW01 for the BNF. I assume should be something like:
.
([+|-]\d+(\s+[AND|OR]\s+'[+|-] '\d+)*)?
.
To make it work properly in python, you need to change the regex to accept "AND"/"OR" as phrases and to bound to the whole string as shown below:
.
^([+|-]\d+(\s+?(AND|OR)\s+[+|-]\d+)*)?$
.
If I am wrong, please let me know.
(Edited: 2017-09-03)
I believe there is an error in the regex for HW01 for the BNF. I assume should be something like: . ([+|-]\d+(\s+[AND|OR]\s+''<u>'[+|-]</u>'''\d+)*)? . To make it work properly in python, you need to change the regex to accept "AND"/"OR" as phrases and to bound to the whole string as shown below: . ^([+|-]\d+(\s+?(AND|OR)\s+[+|-]\d+)*)?$ . If I am wrong, please let me know.

-- HW01 BNF Regex Error
Thanks for pointing that out. There were some typos in my expression. It was more intended to be a Perl/Python style regex than BNF (which is quite restrictive). I have modified my expression. I am not getting too hung up on the start/end line (^ and $) stuff as I have vaguely indicated that by the discussion and example.
Best,
Chris
Thanks for pointing that out. There were some typos in my expression. It was more intended to be a Perl/Python style regex than BNF (which is quite restrictive). I have modified my expression. I am not getting too hung up on the start/end line (^ and $) stuff as I have vaguely indicated that by the discussion and example. Best, Chris
X