- Regular expressions as we basically now them today were made for ed. In that context, '$' absolutely had to match the terminating newline or it would've been completely useless.
by flufluflufluffy
1 subcomments
- The vast majority of the times I use ^/$, I actually want the behavior of matching start/end of lines. If I had some multi-line text, and only wanted to update or do something with the actual beginning or end of the entire text, I’d typically just do it manually.
by seanwilson
1 subcomments
- I wish one of those regex libraries that replaces the regex symbols with human readable words would become standard. Or they don't work well?
Regex is one of those things where I have to look up to remind myself what the symbols are, and by the time I need this info again I've forgotten it all.
I can't think of anywhere else in general programming where we have something so terse and symbol heavy.
- ABC: Always. Build on. Parser Combinators.
Python ecosystem has several options, for instance: https://parsy.readthedocs.io/en/latest/tutorial.html
- For this to matter, it seems that I would have to be in the situation of:
* running a regex not in multi-line mode
* on input that was presumably split from multiple lines, or within a line of multi-line input
* wherein I care whether the line in question is the last line of input without a trailing newline
* but I didn't check, or `.strip()` or anything
I can't say I recall ever being bitten by this.
And there is also nothing here to justify \A over ^.
- so why \A instead of ^?
by svilen_dobrev
0 subcomment
- it's in the spec. Since forever, like v 1.3? don't remember.
And it is same in perl: from `man perlre`:
^ Match the beginning of the string (or line, if /m is used)
- I've said it before and I'll say it again, I'd like Python a lot more if it abandoned re and handled regex like perl did.
by az09mugen
1 subcomments
- They could simply advise to use boundaries '\b' instead.
by queenkjuul
2 subcomments
- Here's 6 incidents for you to ponder
https://www.reuters.com/world/us/evidence-contradicts-trump-...