On Sun, Oct 16, 2016 at 10:29:09PM +0200, nfb wrote:
> > It looks to me as if a second round of evaluation is being done.
> > During the first round the "\"s would be removed leaving "[[0-9]+]".
> > 
> > The second round would pair the first "[" with the first "]", the
> > one before the "+" and would make your character class be digits
> > or opening square bracket.  The final square bracket would be literal.
> > 
> > You may have to play with the number of backslashes, probably doubling
> > them though in some troff documents it was even necessary to tripling
> > them in order to have one preserved when it was needed.
> 
> Thank you, your explanation is plausible... I indeed already tried
> with some escaping before posting. I'll try harder.
> But in any case, doesn't it sound like a bug? Because a correct
> regular expression is not matching as it should.
> Thanks again.

I played around with your sequence and confirmed your observation.
Changing the quotes from double to single quotes seems to get
what you are looking for.

Again that would go along with preserving backslashes during one
round of evaluation.  In a double quoted string parsed by the shell,
depending on the following character, a backslash may be escaping the
next character or may be literal.  Using single quotes removes the
ambiguity and makes them literal irrespective of the next char.

Jon
-- 
Jon H. LaBadie                 j...@jgcomp.com
 11226 South Shore Rd.          (703) 787-0688 (H)
 Reston, VA  20190              (703) 935-6720 (C)

Reply via email to