3 ms·
This isn't really a regex problem though. The regex probably did exactly what the dev intended, it's just that the dev failed to take into account that <author>
by cedilla 3y ago
This isn't really a regex problem though. The regex probably did exactly what the dev intended, it's just that the dev failed to take into account that <author> could also be a 0 length string.
The same logic bug would have occured with a parser.
- account42 3y agoThis is all speculation of course but a parser is more likely to recognize the author: prefix and then error out on anything unexpected in the rest of the line. Meanwhile regular expressions don't have any way to report errors.
- glenjamin 3y agoPersonally I’d have separated finding the Author line from pulling out the contents of that line - but still used Regex