Live data from Hacker News

Learn RegEx step by step, from zero to advanced

regexlearn.com

11–20 of 114 posts

Re: Learn RegEx step by step, from zero to advanced

#12

I have learned regex, I learned it from regexone years ago so appreciate this type of teaching method. What I will say though it it's a little pedantic if you won't let me move on despite my solution being correct. An example is this: [dbf]eer When the answer required was (if I remember correctly): [bdf]eer I think as long as you're correct you should be allowed to move on. By all means show your preferred solution.

What's also a bit of a pain is when you click Show Solution you still have to type it in the box to continue. Apart from that I love it! I normally use regexr.com and just mess around with it until I get the desired result. It also helps with learning, but you end up never truly understanding the concepts.

For most purposes, sites like that or https://regex101.com/ are fine. But, small differences in regexes (greediness, backtracking) can make huge performance differences that you won't notice when testing it on 2 or 3 lines on a site like that.

A nice example was a big Cloudflare outage in 2019: https://blog.cloudflare.com/details-of-the-cloudflare-outage...

So for anyone using regex in (1) production as (2) part of an automation / regular process (i.e. not a one time search) on (3) sizeable amounts or reoccurrences of data, I'd really advice gaining a deeper understanding of what the various options do.

Re: Learn RegEx step by step, from zero to advanced

#17

I learn regex just before I need it. Every. Time. After 25 years, it just doesn't stick.

I'm the same way. I suppose some people use regex's a lot, I never really have.

If our experiences are typical, I'd argue people new to regex's should more learn they exist and when they can be useful, and not worry too much about actually learning their mechanics.

Re: Learn RegEx step by step, from zero to advanced

#19

I learn regex just before I need it. Every. Time. After 25 years, it just doesn't stick.

Same here. Because I never need "regex" as a skill by itself in a project, but just needed to search/replace one damn string for one particular situation, and next year another situation in a completely unrelated place for completely unrelated reasons so whatever I learned (and forgotten) last year wouldn't really apply anyway.

Re: Learn RegEx step by step, from zero to advanced

#20
post #8

>Regular Expressions, abbreviated as RegEx or RegExp, are a string of characters created within the framework of RegEx syntax rules. You can easily manage your data with RegEx, which uses commands like finding, matching, and editing. Regex can be used in programming languages such as Phyton, SQL, Javascript, R, Google Analytics, Google Data Studio, and throughout the coding process. Learn regex online with examples a…

Regex is powerful but I've found like 90% of the time I encounter one it would have been far simpler and more readable to use find + substring indexing or string splitting.

Imo replacing several nested if statements with a single esoteric regex is not necessarily a win. It depends on if pattern matching is really the best tool for the job.

Post reply on HN