On another note, since this is supposed to be a book and all, is there a simple way to get this on one a single page and make it easier to print?
Show HN: RegEx for Regular Folk – A visual, example-based introduction
61–70 of 113 posts
Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction
#62Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction
#63Nice guide! As a complete regex-dyslectic i didn't know the slash '/' could be used to make expressions more readable. On another note, since this is supposed to be a book and all, is there a simple way to get this on one a single page and make it easier to print?
Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction
#64Nice guide! As a complete regex-dyslectic i didn't know the slash '/' could be used to make expressions more readable. On another note, since this is supposed to be a book and all, is there a simple way to get this on one a single page and make it easier to print?
That's not really true. The guide seems to be javascript centric. The slash and flags is not part of the regex, it's a delimiter. In certain contexts like sed, perl, php, an arbitrary delimiter can be used to avoid needing to escape slashes. If you pass a string to a regex engine with a /, it does what you would expect, match a literal /. For instance, python and grep does not interpret slashes and flags. Those are p…
Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction
#65- What are escapes are and what needs to be escaped?
- The structure of a regex.
- Syntax around things like capture (is the parens part of some matcher? what to escape?)
We should have a version of regex that separates characters, character classes and operators, or whatever the regex jargon for those things are. Half the things I usually want to regex for, like parens on a function or dot accessors need to be escaped!
A quick example for illustration purposes (please don't point out why this grammar wont map to regex):
(['a' or 'b'], captureAs="prefix")[number or '.']
is definitely more approachable and easier to explain than the regex equivalent (which I'm avoiding to write because I don't have time to test if I got capture syntax right).Maybe someone makes a wasm regex-simple transformer we can use in multiple languages. Regex is too useful to have such a scary syntax for newcomers!
Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction
#66Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction
#67Maybe I missed it, but there doesn't seem to be any credit given for the xkcd comic ( https://xkcd.com/208/ ) shown on the Next Steps page ( https://refrf.shreyasminocha.me/chapters/next-steps ). Does Randall even require it?
Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction
#68I like the example based approach. I learn from examples far quicker than I learn from “explanations”. If I attempt to learn from an example and my brain hits an exception, only then do I start reading the supporting text. Nice approach. You’ve made a valuable thing and implemented a powerful idea.
I honestly wish a lot more documentations started like that with a bunch of examples. I think one I really enjoyed recently was attrs [0]. [0] https://www.attrs.org/en/stable/examples.html
Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction
#69Nice guide! As a complete regex-dyslectic i didn't know the slash '/' could be used to make expressions more readable. On another note, since this is supposed to be a book and all, is there a simple way to get this on one a single page and make it easier to print?
That's on my TODO!
- https://github.com/shreyasminocha/regex-for-regular-folk/iss... - https://github.com/shreyasminocha/regex-for-regular-folk/iss...
I was having some trouble with wkhtmltopdf, but I'll try to figure this out ASAP.
Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction
#70I sometimes wonder what a syntactically clarified regex could look like. There are two things that often confuse newcomers: - What are escapes are and what needs to be escaped? - The structure of a regex. - Syntax around things like capture (is the parens part of some matcher? what to escape?) We should have a version of regex that separates characters, character classes and operators, or whatever the regex jargon fo…
However I'd argue that it's not actually very hard to learn and its brevity makes it easier to retain. (personally I did so using https://www.regular-expressions.info/tutorial.html)
I agree that escaping is a problem, mainly because languages have often different rules for this.