Quote:
Originally Posted by patrik
The regex-sites I find are all very complex. Isn't there some Regex for dummies out there?
|
Regular-expressions.info is the go-to place for learning Regular Expressions.
"For dummies", the
"Regex Examples" thread in Sigil's forums is good to see a lot of real life examples. Lots of people have asked questions over the years, and people have answered.
I've written multiple posts over the years breaking down Regex into bite-sized chunks, and I try to explain "in normal English" like:
Or sometimes
color coding:
But really, there's not much you can do besides learning the basics. You then just build them up piece-by-piece, and as long as you know what each little piece does, you can tackle the more complicated patterns you recognize.
Last year, I was training a few people in the basics of ebook creation. I created a presentation, and Regex was one of the sections (10 slides).
I showed a handful of common issues that creep up like:
- How to find Page Numbers (p. 123, Page 234)
- Finding 3 capital letters in a row (ABCs, FBI, XYZ)
- Finding lowercase letter in beginning of paragraph
- Correcting spaces around em dashes
- Finding all the "1 a.m." and "9:32 p.m."
- Finding roman numeral chapters (Chapter III)
- Paragraphs that end with no punctuation
- Finding/Correcting punctuation OUTSIDE of quotation marks
- Replacing 98-99 (hyphen) or 98—99 (em dash) with the proper en dash
- [...]
If anyone is interested in those slides, send me a PM. :P