Re: Dealing with empty strings in regexp.

2013-06-18 Thread Paul Isambert
LCD 47 a écrit: > On 18 June 2013, Paul Isambert wrote: > > Hello all, > > > > The following issue has been recently discussed on the Lua mailing list: > > http://lua-users.org/lists/lua-l/2013-04/msg00812.html > > > > (It has also been independantly raised on the LuaTeX list: > > http://tug.or

Re: Dealing with empty strings in regexp.

2013-06-18 Thread LCD 47
On 18 June 2013, Paul Isambert wrote: > Hello all, > > The following issue has been recently discussed on the Lua mailing list: > http://lua-users.org/lists/lua-l/2013-04/msg00812.html > > (It has also been independantly raised on the LuaTeX list: > http://tug.org/pipermail/luatex/2013-June/0044

Re: Dealing with empty strings in regexp.

2013-06-18 Thread Paul Isambert
Erik Christiansen a écrit: > On 18.06.13 14:51, Paul Isambert wrote: > > The “*” operator should be banned, then! > > Does the problem with matching empty strings arise from using "*" when > "+" should be used instead? You are presumably aware that¹: > > * = 0 or more of the preceding atom. > +

Re: Dealing with empty strings in regexp.

2013-06-18 Thread Ben Fritz
On Tuesday, June 18, 2013 7:51:06 AM UTC-5, Paul Isambert wrote: > > > Doing substitutions with a pattern that matches the empty string is > > > not useful, in real editing tasks it's not what is wanted. One is > > > always trying to match *something*. > > > > The “*” operator should be bann

Re: Dealing with empty strings in regexp.

2013-06-18 Thread Erik Christiansen
On 18.06.13 14:51, Paul Isambert wrote: > The “*” operator should be banned, then! Does the problem with matching empty strings arise from using "*" when "+" should be used instead? You are presumably aware that¹: * = 0 or more of the preceding atom. + = 1 or more of the preceding atom. Thus "(a

Re: Dealing with empty strings in regexp.

2013-06-18 Thread Paul Isambert
John Little a écrit: > On Tuesday, June 18, 2013 11:19:43 PM UTC+12, Paul Isambert wrote: > > > I.e., shouldn’t it work clearly one way or the other? > > I don't understand this "interspersed empty substrings" way of > looking at regexes; I suspect that it doesn't make sense some of the > time,

Re: Dealing with empty strings in regexp.

2013-06-18 Thread John Little
On Tuesday, June 18, 2013 11:19:43 PM UTC+12, Paul Isambert wrote: > I.e., shouldn’t it work clearly one way or the other? I don't understand this "interspersed empty substrings" way of looking at regexes; I suspect that it doesn't make sense some of the time, and is not useful, but my suspici

Re: Dealing with empty strings in regexp.

2013-06-18 Thread Paul Isambert
Sorry, this > print re.sub(re.compile('(a*)'), '(\\1)', 'abc') should be print re.sub(re.compile('([ac]*)'), '(\\1)', 'abc') Paul -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, vi