[oXygen-user] regular expression problem

Toufexis Notis
Sun Nov 11 12:35:59 CST 2007


Yep, this really does not seem to be a bug. It was actually only the  
last digit that was being copied, thus the "greedy" .+ was  
responsible. I had solved the problem with an additional space in the  
reg. expression, but your solution is much more elegant. Thanks!
N.

On 11 Nov 2007, at 18:06, Syd Bauman wrote:

> I've been able to duplicate this problem using the regular expression
> posted, using oXygen 9 on Mac OS X, using the lyrics below. (Numbered
> as if they were a basic program, as there are < 10 lines :-)
>
> However, I'm not sure it's a bug. I think maybe the regexp is working
> as advertised. The ".+" in the second parenthetical is greedy, and
> should grab all but the last digit, I think. To make it non-greedy
> use ".+?".
>
> original:
>> <l>(.+)(\d+)(</l>)
>> <l n="$2"> $1 ($2) $3
>
> possible improved version:
>   <l>(.+?)(\d+)(</l>)
>   <l n="$2"> $1 ($2) $3
>
>
>> Strangely, from time to time only the first digit is being copied
>> with the replace function, although all digits are being
>> highlighted with the search function.
>
> Of course, all digits (actually, the entire <l> element) is being
> highlighted with the search function, no?
>
> Below
> -----
>       <lg type="test">
>         <note>To the tune of Weber &amp; Rice's <title>Don't Cry for
>         me Argentina</title></note>
>         <l>Don't cry for me Charles Goldfarb, 10</l>
>         <l>The truth is I do not miss them, 20</l>
>         <l>All of those features, 30</l>
>         <l>Because we're lazy, 40</l>
>         <l>To save us typing, 50</l>
>         <l>They drove us crazy. 60</l>
>       </lg>
>
> _______________________________________________
> oXygen-user mailing list
> 
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user




More information about the oXygen-user mailing list