https://bz.apache.org/ooo/show_bug.cgi?id=107619

--- Comment #20 from Kay <ksch...@apache.org> ---
(In reply to mikekaganski from comment #19)
> (In reply to Kay from comment #18)
> > (In reply to Francis C. Costero from comment #17)
> > > Find: ([^ ]*)[ ]*([^ ]*) 
> > 
> > Match zero or more occurences of a space following the beginning (grouping
> > 1),  followed by  zero or more occurrences of "space", followed by match
> > zero or more occurrences of a space following the beginning of the line
> > (grouping 2).
> 
> Incorrect. [^ ] doesn't mean "a space following the beginning of the line",
> it's "Any character except space" syntax. Here "space" means character 0x20,
> not "any whitespace character" like [:space:], of course.
> 
> If it were "a space following the beginning of the line", then in any of the
> following examples both groups would be empty (there's no lines starting
> with space).
> 
> Thus, this means (taking greedy processing of "*" into account): put as much
> non-space characters as possible into the first grouping (possibly empty if
> the first char is space), THEN skip any spaces (if present), THEN take as
> much as possible of non-space characters LEFT into the second grouping
> (maybe zero if no other characters after those spaces). Anyway, first and
> last groupings represent DIFFERENT groups of characters, they may have
> identical value only if those different groups have identical characters in
> them.
> 
> > > Replace: $1$2
> > > I get the following after clicking Replace All
> > > 987987
> > 
> > This is correct. In this case $1 and $2 are identical because there is zero
> > or no occurrence of the "intervening" space.
> 
> Incorrect. In this case $1 MUST be "987", and $2 MUST be "".
> 
> > > ab
> > 
> > This is correct. There was an intervening space.
> 
> OK.
> 
> > > aa
> > 
> > This is correct and the same as the "987" string case.
> 
> No, this is INCORRECT and the same as the "987" string case.

OMG! I stand corrected! you are right, mikekaganski!

-- 
You are receiving this mail because:
You are on the CC list for the issue.
You are the assignee for the issue.

Reply via email to