You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by Herbert Duerr <hd...@apache.org> on 2011/09/30 15:08:18 UTC
i18nregexp replaced with ICU regexp => heads up
Hi,
for removing "category X excluded licenses" from Apache OpenOffice I
replaced the formerly used LGPL licensed module i18nregexp with the
regular expression engine of module ICU which is already widely use in
OpenOffice.
The replacement fixes a lot of problems: e.g. in a text "abcabc" trying
to "find all backwards" for "b" resulted in it only finding the last
"b", now it actually finds all of them. It also introduces some changes,
e.g. i18nregexp had two modes "classic" and "extended" regexp whereas
the ICU based engine treats all patterns as extended-regexp.
I18nregexp used an approach where it transliterated and compared each
codepoint pair of the pattern and text string. The new engine does the
transliteration only once per pattern and text string. This is much
faster, but it only works because the transliteration was tweaked to
preserve the special regexp control characters.
The reporters of any issues in the lists below are encouraged to check
the problems they saw with the new engine.
https://issues.apache.org/ooo/buglist.cgi?quicksearch=regexp
https://issues.apache.org/ooo/buglist.cgi?quicksearch=regular\ expression
Please make sure to have the "More Options -> Regular Expressions"
checkbox activated for testing.
I'm afraid the regexp replacement resulted in changes mostly for
Japanese users, because there a lot of non-trivial transliterations are
active. For reference I'm enumerating the active rules:
"ProlongedSoundMark", "IterationMark", "Ignore-Width", "BaFa", "SeZe",
"HyuByu", "IandEfollowedByYa" and "KiKuFollowedBySa".
Herbert
Re: i18nregexp replaced with ICU regexp => heads up
Posted by tora - Takamichi Akiyama <to...@openoffice.org>.
Hi Herbert,
Thank you for your efforts.
On 2011/09/30 22:08, Herbert Duerr wrote:
> Please make sure to have the "More Options -> Regular Expressions" checkbox activated for testing.
>
> I'm afraid the regexp replacement resulted in changes mostly for Japanese users, because there a lot of non-trivial transliterations are active. For reference I'm enumerating the active rules: "ProlongedSoundMark", "IterationMark", "Ignore-Width", "BaFa", "SeZe", "HyuByu", "IandEfollowedByYa" and "KiKuFollowedBySa".
That sounds an area of mine...
Tora
Re: i18nregexp replaced with ICU regexp => heads up
Posted by Herbert Duerr <hd...@apache.org>.
Replying to myself to give a status update.
> FYI, I'm also considering to extend the ICU regexp matcher with the
> bracket extension mentioned above if there is a chance that it gets into
> upstream ICU.
For the convenience of a smooth upgrade experience I committed r1234777
so that AOO now emulates the \< and \> expressions by mapping them to \b
for matching word boundaries.
Using ICU's powerful regular expression engine has quite some benefits
for conforming to the Unicode standard. E.g. finding word boundaries now
respects UAX#29 (Unicode Standard Annex #29: Text Segmentation) whereas
the old engine used a rather simple heuristic. As an example it couldn't
find word boundaries in scripts like Thai that don't use spaces or
punctuation symbols for separating words.
I'll update the release notes accordingly.
Herbert
Re: i18nregexp replaced with ICU regexp => heads up
Posted by Herbert Duerr <hd...@apache.org>.
>>> For the specific example of the RE-extension "\<" the more common syntax
>>> for it is "\b" and that is also understood by almost all regex engines
>>> including the ones used in old and new OOo.
>> We should keep this in mind for the release notes and should update the
>> docu, help as soon as possible
>
> I tried to add a paragraph summarizing this thread to the Release Notes:
>
> https://cwiki.apache.org/confluence/display/OOOUSERS/AOO+3.4+Release+Notes
Looks good, thanks.
FYI, I'm also considering to extend the ICU regexp matcher with the
bracket extension mentioned above if there is a chance that it gets into
upstream ICU.
There are good reasons that speak against it like
- the \< \> extension is unusual for a regexp engine
(see http://www.regular-expressions.info/refflavors.html)
- the \< for word start matching is already available in its more common
form \b
- the \> for word end matching can often be replaced by \W
- backslash escaping of non-ASCII characters should preferably be
literal escaping
On the other hand the older regexp dialect which has the bracket
extension has been available in many releases of OOo and we would like
to make the migration to AOO as smooth as possible.
Herbert
Re: i18nregexp replaced with ICU regexp => heads up
Posted by Andrea Pescetti <pe...@apache.org>.
On 04/01/2012 Jürgen Schmidt wrote:
> On 1/4/12 4:26 PM, Herbert Duerr wrote:
>> For the specific example of the RE-extension "\<" the more common syntax
>> for it is "\b" and that is also understood by almost all regex engines
>> including the ones used in old and new OOo.
> We should keep this in mind for the release notes and should update the
> docu, help as soon as possible
I tried to add a paragraph summarizing this thread to the Release Notes:
https://cwiki.apache.org/confluence/display/OOOUSERS/AOO+3.4+Release+Notes
Of course, feel free to improve accuracy/contents/language.
Regards,
Andrea.
Re: i18nregexp replaced with ICU regexp => heads up
Posted by Jürgen Schmidt <jo...@googlemail.com>.
On 1/4/12 4:26 PM, Herbert Duerr wrote:
>> Thanks! I think we will need to make more clear to the users this change:
>> many old documents with macros that rely on the old syntax will not
>> work on
>> AOO 3.4.
>
> Yes, it should be pointed out that there are quite a number of different
> regexp flavors and that people should try to stay on the common ground.
>
> For the specific example of the RE-extension "\<" the more common syntax
> for it is "\b" and that is also understood by almost all regex engines
> including the ones used in old and new OOo.
we should check the help files for this and should may include a link to
http://www.regular-expressions.info/reference.html. But that requires
translation :-(
We should keep this in mind for the release notes and should update the
docu, help as soon as possible
Juergen
>
>> Also, I think I found a problem. Suppose you have a text like "He heard
>> quiet quiet steps". By using a regexp like
>> (\w+) \1\b
>> (notice the space before the \1) you'll find the repeated word without
>> problems, but if you use $1 on "Replace with" instead of obtaining "He
>> heard quiet steps" you get "He heard steps", with two spaces between
>> "heard" and "steps": the reference is not inserted!
>
> https://issues.apache.org/ooo/show_bug.cgi?id=118723
> I'll look into it.
>
> Herbert
Re: i18nregexp replaced with ICU regexp => heads up
Posted by RGB ES <rg...@gmail.com>.
2012/1/4 Herbert Duerr <hd...@apache.org>
> https://issues.apache.org/ooo/show_bug.cgi?id=118723
> I'll look into it.
>
> Herbert
>
Many thanks!!
Re: i18nregexp replaced with ICU regexp => heads up
Posted by Herbert Duerr <hd...@apache.org>.
> Thanks! I think we will need to make more clear to the users this change:
> many old documents with macros that rely on the old syntax will not work on
> AOO 3.4.
Yes, it should be pointed out that there are quite a number of different
regexp flavors and that people should try to stay on the common ground.
For the specific example of the RE-extension "\<" the more common syntax
for it is "\b" and that is also understood by almost all regex engines
including the ones used in old and new OOo.
> Also, I think I found a problem. Suppose you have a text like "He heard
> quiet quiet steps". By using a regexp like
> (\w+) \1\b
> (notice the space before the \1) you'll find the repeated word without
> problems, but if you use $1 on "Replace with" instead of obtaining "He
> heard quiet steps" you get "He heard steps", with two spaces between
> "heard" and "steps": the reference is not inserted!
https://issues.apache.org/ooo/show_bug.cgi?id=118723
I'll look into it.
Herbert
Re: i18nregexp replaced with ICU regexp => heads up
Posted by Rob Weir <ro...@apache.org>.
On Wed, Jan 4, 2012 at 3:31 PM, Dennis E. Hamilton
<de...@acm.org> wrote:
> I think there are three concerns regarding the substitution of ICU regexp (a move that I favor):
>
> 1. There are whatever the internal usages are within AOO. Those don't need to be documented externally.
>
> 2. There are the places where users may specify regular expressions, especially in Calc and macro procedures. For those, there needs to be precise documentation as well as any indication of what the impact is in Release Notes.
>
> 3. There are the occurrences of regular expressions in the ODF documents that are consumed and produced and that are covered in the ODF 1.0/1.1/1.2 specifications. Excluding macros (which are not covered in any version of ODF), these present potential interoperability issues among producers and consumers of the same (e.g., OpenOffice) and different lineage.
> Here there needs to be enough documentation of what ODF leaves discretionary so that interoperability can be assured.
>
Hmmm... regular expressions are used in table filters, for example the
filter feature in Calc. Are there any others that we should be
thinking about?
The nice thing is that ODF defines the syntax per Unicode Regular Expressions:
http://www.unicode.org/reports/tr18/tr18-13.html
So by moving to ICU, OpenOffice might for the first time actually
conform to that part of the spec!
But you are correct that we need to make sure this is in the release
notes, so that users are not confused by this sudden conformance.
(BTW, is there a draft of the 3.4 release notes on a wiki or someplace
else we should be updating?)
> So there are these three cases, where perhaps the most urgent documentation is (2) and then (3) because in the latter case, there may be unexpected or even un-noticed unexpected results and users won't know what to do. That will not encourage trust.
>
This is one example of hundreds. It caught your eye -- and that is a
good thing -- because it has an obvious relation with ODF. But we
should also think about how we can get the all the other similar
problems.
For example, a test script that loads a bunch of legacy documents in
OOo 3.3.0, grabs a screen shot, saves as a bitmap. (Or save as PDF).
Repeat with 3.4 build. Automate a diff the bitmaps or PDF's. Flag
any differences for manual review. You can be certain that vendors
who take version to version interop very seriously do something like
this. I wonder how hard it would be to do something similar? (Of
course, visual layout and appearance is only one aspect of interop,
but it is an important one)
> - Dennis
>
> -----Original Message-----
> From: RGB ES [mailto:rgb.mldc@gmail.com]
> Sent: Wednesday, January 04, 2012 05:44
> To: ooo-dev@incubator.apache.org
> Subject: Re: i18nregexp replaced with ICU regexp => heads up
>
> 2012/1/4 Herbert Duerr <hd...@apache.org>
>
>> On 03.01.2012 19:13, RGB ES wrote:
>>
>>> Sorry for reactivating this old thread, but I have a question about the
>>> new
>>> regexp engine: it seems that some regular expressions do not work any more
>>> on AOO test builds. For example, on OOo 3.3 you can use
>>> \<[0-9]+[,|\.][0-9]*\>
>>> to find decimal numbers no matter if the decimal separator is a colon or a
>>> dot (the expression will find 125.25 and 1253,586) but this expression do
>>> not work on AOO builds.
>>>
>>
>> Following up myself, AOO will both find strings like "<125.25>" and
>> "<1253,586>" for the example regexp you provided, but it will not find
>> "125.25" and "1253,586".
>>
>> http://www.regular-**expressions.info/refflavors.**html<http://www.regular-expressions.info/refflavors.html>mentions the \< and \> that are used in your regexp example as non-standard
>> extensions to the syntax. With using the new engine we are closer to the
>> reference http://www.regular-**expressions.info/reference.**html<http://www.regular-expressions.info/reference.html>
>>
>> Herbert
>>
>
> Thanks! I think we will need to make more clear to the users this change:
> many old documents with macros that rely on the old syntax will not work on
> AOO 3.4.
>
> Also, I think I found a problem. Suppose you have a text like "He heard
> quiet quiet steps". By using a regexp like
> (\w+) \1\b
> (notice the space before the \1) you'll find the repeated word without
> problems, but if you use $1 on "Replace with" instead of obtaining "He
> heard quiet steps" you get "He heard steps", with two spaces between
> "heard" and "steps": the reference is not inserted!
>
> Ricardo
>
RE: i18nregexp replaced with ICU regexp => heads up
Posted by "Dennis E. Hamilton" <de...@acm.org>.
I think there are three concerns regarding the substitution of ICU regexp (a move that I favor):
1. There are whatever the internal usages are within AOO. Those don't need to be documented externally.
2. There are the places where users may specify regular expressions, especially in Calc and macro procedures. For those, there needs to be precise documentation as well as any indication of what the impact is in Release Notes.
3. There are the occurrences of regular expressions in the ODF documents that are consumed and produced and that are covered in the ODF 1.0/1.1/1.2 specifications. Excluding macros (which are not covered in any version of ODF), these present potential interoperability issues among producers and consumers of the same (e.g., OpenOffice) and different lineage.
Here there needs to be enough documentation of what ODF leaves discretionary so that interoperability can be assured.
So there are these three cases, where perhaps the most urgent documentation is (2) and then (3) because in the latter case, there may be unexpected or even un-noticed unexpected results and users won't know what to do. That will not encourage trust.
- Dennis
-----Original Message-----
From: RGB ES [mailto:rgb.mldc@gmail.com]
Sent: Wednesday, January 04, 2012 05:44
To: ooo-dev@incubator.apache.org
Subject: Re: i18nregexp replaced with ICU regexp => heads up
2012/1/4 Herbert Duerr <hd...@apache.org>
> On 03.01.2012 19:13, RGB ES wrote:
>
>> Sorry for reactivating this old thread, but I have a question about the
>> new
>> regexp engine: it seems that some regular expressions do not work any more
>> on AOO test builds. For example, on OOo 3.3 you can use
>> \<[0-9]+[,|\.][0-9]*\>
>> to find decimal numbers no matter if the decimal separator is a colon or a
>> dot (the expression will find 125.25 and 1253,586) but this expression do
>> not work on AOO builds.
>>
>
> Following up myself, AOO will both find strings like "<125.25>" and
> "<1253,586>" for the example regexp you provided, but it will not find
> "125.25" and "1253,586".
>
> http://www.regular-**expressions.info/refflavors.**html<http://www.regular-expressions.info/refflavors.html>mentions the \< and \> that are used in your regexp example as non-standard
> extensions to the syntax. With using the new engine we are closer to the
> reference http://www.regular-**expressions.info/reference.**html<http://www.regular-expressions.info/reference.html>
>
> Herbert
>
Thanks! I think we will need to make more clear to the users this change:
many old documents with macros that rely on the old syntax will not work on
AOO 3.4.
Also, I think I found a problem. Suppose you have a text like "He heard
quiet quiet steps". By using a regexp like
(\w+) \1\b
(notice the space before the \1) you'll find the repeated word without
problems, but if you use $1 on "Replace with" instead of obtaining "He
heard quiet steps" you get "He heard steps", with two spaces between
"heard" and "steps": the reference is not inserted!
Ricardo
Re: i18nregexp replaced with ICU regexp => heads up
Posted by RGB ES <rg...@gmail.com>.
2012/1/4 Herbert Duerr <hd...@apache.org>
> On 03.01.2012 19:13, RGB ES wrote:
>
>> Sorry for reactivating this old thread, but I have a question about the
>> new
>> regexp engine: it seems that some regular expressions do not work any more
>> on AOO test builds. For example, on OOo 3.3 you can use
>> \<[0-9]+[,|\.][0-9]*\>
>> to find decimal numbers no matter if the decimal separator is a colon or a
>> dot (the expression will find 125.25 and 1253,586) but this expression do
>> not work on AOO builds.
>>
>
> Following up myself, AOO will both find strings like "<125.25>" and
> "<1253,586>" for the example regexp you provided, but it will not find
> "125.25" and "1253,586".
>
> http://www.regular-**expressions.info/refflavors.**html<http://www.regular-expressions.info/refflavors.html>mentions the \< and \> that are used in your regexp example as non-standard
> extensions to the syntax. With using the new engine we are closer to the
> reference http://www.regular-**expressions.info/reference.**html<http://www.regular-expressions.info/reference.html>
>
> Herbert
>
Thanks! I think we will need to make more clear to the users this change:
many old documents with macros that rely on the old syntax will not work on
AOO 3.4.
Also, I think I found a problem. Suppose you have a text like "He heard
quiet quiet steps". By using a regexp like
(\w+) \1\b
(notice the space before the \1) you'll find the repeated word without
problems, but if you use $1 on "Replace with" instead of obtaining "He
heard quiet steps" you get "He heard steps", with two spaces between
"heard" and "steps": the reference is not inserted!
Ricardo
Re: i18nregexp replaced with ICU regexp => heads up
Posted by Herbert Duerr <hd...@apache.org>.
On 03.01.2012 19:13, RGB ES wrote:
> Sorry for reactivating this old thread, but I have a question about the new
> regexp engine: it seems that some regular expressions do not work any more
> on AOO test builds. For example, on OOo 3.3 you can use
> \<[0-9]+[,|\.][0-9]*\>
> to find decimal numbers no matter if the decimal separator is a colon or a
> dot (the expression will find 125.25 and 1253,586) but this expression do
> not work on AOO builds.
Following up myself, AOO will both find strings like "<125.25>" and
"<1253,586>" for the example regexp you provided, but it will not find
"125.25" and "1253,586".
http://www.regular-expressions.info/refflavors.html mentions the \< and
\> that are used in your regexp example as non-standard extensions to
the syntax. With using the new engine we are closer to the reference
http://www.regular-expressions.info/reference.html
Herbert
Re: i18nregexp replaced with ICU regexp => heads up
Posted by Herbert Duerr <hd...@apache.org>.
On 03.01.2012 19:13, RGB ES wrote:
> Are there changes on the regexp syntax? If yes, where are those changes
> documented?
With ICU being the new engine used for this task its rules apply. Please
see http://userguide.icu-project.org/strings/regexp
Herbert
Re: i18nregexp replaced with ICU regexp => heads up
Posted by RGB ES <rg...@gmail.com>.
2011/9/30 Herbert Duerr <hd...@apache.org>
> Hi,
>
> for removing "category X excluded licenses" from Apache OpenOffice I
> replaced the formerly used LGPL licensed module i18nregexp with the regular
> expression engine of module ICU which is already widely use in OpenOffice.
>
> The replacement fixes a lot of problems: e.g. in a text "abcabc" trying to
> "find all backwards" for "b" resulted in it only finding the last "b", now
> it actually finds all of them. It also introduces some changes, e.g.
> i18nregexp had two modes "classic" and "extended" regexp whereas the ICU
> based engine treats all patterns as extended-regexp.
>
> I18nregexp used an approach where it transliterated and compared each
> codepoint pair of the pattern and text string. The new engine does the
> transliteration only once per pattern and text string. This is much faster,
> but it only works because the transliteration was tweaked to preserve the
> special regexp control characters.
>
> The reporters of any issues in the lists below are encouraged to check the
> problems they saw with the new engine.
> https://issues.apache.org/ooo/**buglist.cgi?quicksearch=regexp<https://issues.apache.org/ooo/buglist.cgi?quicksearch=regexp>
> https://issues.apache.org/ooo/**buglist.cgi?quicksearch=**regular\<https://issues.apache.org/ooo/buglist.cgi?quicksearch=regular%5C>expression
> Please make sure to have the "More Options -> Regular Expressions"
> checkbox activated for testing.
>
> I'm afraid the regexp replacement resulted in changes mostly for Japanese
> users, because there a lot of non-trivial transliterations are active. For
> reference I'm enumerating the active rules: "ProlongedSoundMark",
> "IterationMark", "Ignore-Width", "BaFa", "SeZe", "HyuByu",
> "IandEfollowedByYa" and "KiKuFollowedBySa".
>
> Herbert
>
Sorry for reactivating this old thread, but I have a question about the new
regexp engine: it seems that some regular expressions do not work any more
on AOO test builds. For example, on OOo 3.3 you can use
\<[0-9]+[,|\.][0-9]*\>
to find decimal numbers no matter if the decimal separator is a colon or a
dot (the expression will find 125.25 and 1253,586) but this expression do
not work on AOO builds.
Are there changes on the regexp syntax? If yes, where are those changes
documented?
Thanks in advance
Ricardo
Re: i18nregexp replaced with ICU regexp => heads up
Posted by Pedro Giffuni <pf...@apache.org>.
--- On Fri, 9/30/11, Herbert Duerr <hd...@apache.org> wrote:
> Hi,
>
> for removing "category X excluded licenses" from Apache
> OpenOffice I replaced the formerly used LGPL licensed module
> i18nregexp with the regular expression engine of module ICU
> which is already widely use in OpenOffice.
>
> The replacement fixes a lot of problems: e.g. in a text
> "abcabc" trying to "find all backwards" for "b" resulted in
> it only finding the last "b", now it actually finds all of
> them. It also introduces some changes, e.g. i18nregexp had
> two modes "classic" and "extended" regexp whereas the ICU
> based engine treats all patterns as extended-regexp.
>
Well done Herbert!! This is one of those changes where
I can see the IP cleanup also contributes towards making
AOOo a much better product!
Pedro.