2 ms·
> The (?xm) notation is a modifier that allows the regular expression to span multiple lines and to use comments. This is incorrect. (?xm) enables the VERBOSE
by jwilk 4y ago
> The (?xm) notation is a modifier that allows the regular expression to span multiple lines and to use comments.
This is incorrect.
(?xm) enables the VERBOSE (X) and MULTILINE (M) flags.
From the docstring:
M MULTILINE "^" matches the beginning of lines (after a newline)
as well as the string.
"$" matches the end of lines (before a newline) as well
as the end of the string.
X VERBOSE Ignore whitespace and comments for nicer looking RE's.
- xdfgh1112 4y agoThe X flag also allows the written regex to span multiple lines, i.e. it counts newlines as whitespace. Interesting confusion there.
- simonw 4y agoHah yeah, good catch - I'd missed that incorrect "allows it to span multiple lines" statement.
- bo1024 4y agoThe scary part about good AI is not knowing how good it is, i.e. not being able to trust it because you don't know when it'll be wrong (nor does the AI itself know).
- solardev 4y agoSame could be true of human programmers though. Except those on HN, of course ;)