Daniel Naber <daniel.na...@languagetool.org> wrote:

> On 2015-10-11 12:31, Daniel Naber wrote:
>
> >> Use of "exact-meaning" would be very rare.
> >> Maybe a better name: <regexp collapse_spaces="no">
> >
> > I think that's okay with me, but I need to think more about it. Maybe
> > the easiest implementation would be to just replace " " by "\s+" before
> > the regex is applied (but not in "[...]")?
>
> I've just committed a change so that <regexp> are now 'smart' by
> default, i.e. you can use a space in the regex and it will internally be
> converted to "\s+" (actually even to "(?:\s+)").
>
> I also wanted the smart type to add \b around the regex, but it's not
> that easy. For example, if you have <regexp>Dr\.<regexp>, you'd get the
> expression "\bDr\.\b", which will not match when e.g. a space follows,
> as the dot is not a boundary character. I'll search for a better
> solution.

Thanks for the (?:\s+) change!
How about... (?:[\sxA0]+)  instead?

If the automatic \b is not easy, then we should not bother.
I can see in your example why it's not easy.
Adding \b manually is OK.

Being able to highlight part the regexp would be useful with
<regexp marker="1">...(...)...</regexp>.  Most of the places
where I'm thinking of using <regexp ...> would need it.

It would also be useful if each group captured in the regexp
could be re-used with \1 \2 \3 etc. (or <match no="1"/> ...)  inside
the <message> or <suggestion>.

Thanks again
Dominique

------------------------------------------------------------------------------
_______________________________________________
Languagetool-devel mailing list
Languagetool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-devel

Reply via email to