Hacker News new | ask | show | jobs
by d--b 3022 days ago
> our pattern becomes:

> \A(?=\w{6,10}\z)(?=[^a-z][a-z])(?=(?:[^A-Z][A-Z]){3})(?=\D\d).

And then these guys wonder why people hate regexes? The "now you have 2 problems" quote fit perfectly for that case.

2 comments

The regexp syntax was devised for write-only programming at the terminal (at a time when a terminal was a physical object, not a window in your GUI).

The regular formalism is pretty neat though. There are alternative syntaxes (e.g. multiline regexps in Python) that are better suited for complex matchers.

Can you put line returns and indents in a regex?

If you escape them it should work, I guess.