A rust macro that allows regular expression creation through independent files. Allows fully typed named groups.
Corrected comments
1 file changed, +3 -2
+3-2tests/regex/Event.re
| @@ -1,11 +1,12 @@ | ||
| 1 | -# This will create a struct called Event with the fields start, end, ampm, and activity | |
| 1 | +# This will create a struct called EventRE with the fields start, end, ampm, and activity | |
| 2 | 2 | |
| 3 | 3 | # Get the start |
| 4 | -(?<start>\d{1,2}:\d{1,2}) | |
| 4 | +^(?<start>\d{1,2}:\d{1,2}) | |
| 5 | 5 | . |
| 6 | 6 | # Get the end time |
| 7 | 7 | (?<end>\d{1,2}:\d{1,2}) |
| 8 | 8 | \s{0,2} |
| 9 | + | |
| 9 | 10 | # Get the AM or PM after the times |
| 10 | 11 | (?<ampm>[AMPM]{2}) |
| 11 | 12 | . |