Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #7317
| From | Robert Klemme <shortcutter@googlemail.com> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | Re: recompose strings of limited length |
| Date | 2016-12-24 18:37 +0100 |
| Message-ID | <ec7q3dFt0icU1@mid.individual.net> (permalink) |
| References | <slrno5g259.idu.michael.uplawski@drusus.uplawski.eu> <ebtaslFd966U1@mid.individual.net> <slrno5kkd5.6gv.michael.uplawski@drusus.uplawski.eu> <ebvudmF22ngU1@mid.individual.net> <slrno5np2o.2vl.michael.uplawski@drusus.uplawski.eu> |
On 22.12.2016 15:34, Michael Uplawski wrote: > On Wed, 21 Dec 2016 19:02:29 +0100, > Robert Klemme <shortcutter@googlemail.com> wrote: > >> You should really get familiar with regular expressions. One book I >> usually recommend is "Mastering Regular Expressions" (O'Reilly). > > You are probably right. The difficulties that I have with String.scan > (and functions documented in a similar way) are certainly induced by my > using Regexps scarcely and only those, that I already master for some > time. The knowledge needed about regular expressions and Ruby's dialect of them is obviously vast compared to the basic mechanics of these methods. So the documentation has to leave that "bit" out. > In which way do you consider the O'Reilly book superior to other > publications or, to simplify, the man-pages to egrep, regex (7) or the > RDoc to Regexp, my principal though rarely consulted sources of > information? The book is not a textbook on formal languages (like the classic dragonbook) but rather a pragmatic's guide to how modern regex engines work, why they work that way and what the side effects of the fact are that most are NFA today (famous exception: sed). It explains how to write expressions to efficiently match and shows techniques to tackle specific problems. https://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools Manpages of grep also touch regular expressions very briefly only and do not explain the concept. > I will consider this. Paul Lutus put a “Regular Expression Laboratory” > on his web-site (what did he *not* put on his web-site, actually?). It > is simpler with less options than the “Regex-Coach”: > http://arachnoid.com/regex_lab/index.html But there is a fundamental difference: that tool will only highlight matches - something that you can do with IRB or grep (with match coloring) or any other tool / language. But with the Coach you can watch how the engine (a NFA btw.) actually matches internally. You see the backtracking that will occur in certain circumstances etc. > Cheerio. ... Mrs. Sophie! robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/
Back to comp.lang.ruby | Previous | Next — Previous in thread | Next in thread | Find similar
recompose strings of limited length Michael Uplawski <michael.uplawski@uplawski.eu> - 2016-12-19 17:19 +0100
Re: recompose strings of limited length Robert Klemme <shortcutter@googlemail.com> - 2016-12-20 19:16 +0100
Re: recompose strings of limited length Michael Uplawski <michael.uplawski@uplawski.eu> - 2016-12-21 10:55 +0100
Re: recompose strings of limited length Robert Klemme <shortcutter@googlemail.com> - 2016-12-21 19:02 +0100
Re: recompose strings of limited length Michael Uplawski <michael.uplawski@uplawski.eu> - 2016-12-22 15:34 +0100
Re: recompose strings of limited length Robert Klemme <shortcutter@googlemail.com> - 2016-12-24 18:37 +0100
Re: recompose strings of limited length "Robert L." <No_spamming@noWhere_7073.org> - 2017-01-15 14:10 +0000
csiph-web