The true power of regular expressions (2012)
1–10 of 62 posts
Re: The true power of regular expressions (2012)
#2Now they have three problems.
Re: The true power of regular expressions (2012)
#3Re: The true power of regular expressions (2012)
#4If I am trying to e.g. count div tags with a regex like "As soon as you also add character classes to ignore various parts of the document that you are not interested in like "]*>" or whatever it is, then it is eminently useful even if the bit we are ignoring is not fully regular.
One lovely thing about regex is how fast it is. I was asked to parse a massive CAN Bus log file for how many times some event had logged. This was the early 2000s and the file was 6GB, which was pretty big. I tried .Net's string.StartsWith or something and that took ages to run through the file. I did the same thing with a regex and it finished in like 5 seconds (HDD, not SSD!). I don't know how the magic works but it is very impressive.
Re: The true power of regular expressions (2012)
#5Re: The true power of regular expressions (2012)
#6Re: The true power of regular expressions (2012)
#7Re: The true power of regular expressions (2012)
#8Re: The true power of regular expressions (2012)
#9Every time I cut-n-paste a regex into code, I comment with the url of the spell book page I copied so future me can answer, "WTF does this do again?"
Re: The true power of regular expressions (2012)
#10OT but this me-problem makes me angry every time I read it. Nothing is simple, otherwise it is trivial and not worth mentioning. I can't read over this without thinking that I'm not smart enough to wrap my head around something instantly.