Question: [6 points) Write a regular expression for comments of the form / ... /. (1) The comment begins with /* and end with the first
[6 points) Write a regular expression for comments of the form / ... /. (1) The comment begins with /* and end with the first / encountered. (2) Optional whitespace can precede the comment or follow the comment, but nothing else. Whitespace consists of spaces and or tabs (lt). Don't include newline ( (3) The text of the comments can include letters or digits, space, tab, underscore... and /. (4) (5) (6) (7) The comment can include / but we don't nest comments. The star of the beginning /* cannot be the star of the ending /. The symbol before the ending */ doesn't have to be whitespace. Inside a regular expression, if you want a star symbol, escape it as since just means Kleene star. (So within the expression, write to mean a slash followed by a star. As an expression, just/ means zero or more slashes Some strings that should fail to match: /* xyz */ */ /* /* xyz ./ */ By rules 1 and 2 By rules 1.2 and 4 By rule 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
