Comments on: “Zero or more” https://backreference.org/2010/08/10/zero-or-more/ Proudly uncool and out of fashion Sun, 23 Jul 2017 11:18:44 +0000 hourly 1 https://wordpress.org/?v=5.8.2 By: Mussé Redi https://backreference.org/2010/08/10/zero-or-more/#comment-25302 Sun, 23 Jul 2017 11:18:44 +0000 http://backreference.org/?p=2504#comment-25302 Thank you very much, this was just the explanation I was looking for! I didn't consider two things before reading this; 1) that a string of zero length is considered a match by "zero or more times"; 2) that greediness matters only when multiple matches are possible at the same position.

]]>
By: Nick C https://backreference.org/2010/08/10/zero-or-more/#comment-1373 Wed, 11 Aug 2010 02:20:14 +0000 http://backreference.org/?p=2504#comment-1373 Thanks for this, it summarises nicely the difference between the various implementations of regex: BRE, ERE and Gnu.

One thing I find frustrating is the inconsistency in control chars, i.e. the []{}()*?+ and so on. I really wish the original implementers had thought it through more carefully. I'm talking about (to use your examples) why the [] of [0-9] are not escaped, but the {} of \{1,\} *are* escaped. There doesn't seem to be any rhyme or reason to it, you just have to memorise how the various control chars are treated.

Then there are the inconsistent implementations or implementations that are only partial: bash, vim and python's regex are all different to each other, for example.

Of course, we are stuck with the situation now, there are just too many scripts that rely on it.

]]>