[fpc-pascal] A Regular Expression failing on the borders of words
luciano de souza
luchyanus at gmail.com
Thu Apr 10 15:05:44 CEST 2014
Well, I need to study more. I can't understand what is wrong. The
match starts with a blank space: \s+. Some string follows: .*. And it
ends in the border of word: \b. So, (\s+.*\b)*, for me, should return:
+ABC +DEF. If "@" is not present, why the rest of the string was
matched.
My knowledge about Regular Expressions is small, so I really need to study more.
2014-04-10 4:16 GMT-03:00, Mattias Gaertner <nc-gaertnma at netcologne.de>:
> On Thu, 10 Apr 2014 02:43:41 -0300
> luciano de souza <luchyanus at gmail.com> wrote:
>
>>[...]
>> r.expression := '^(x\s+)*(\([A-E]\))*(\s*.*\.)+(\s+\+.*\b)*(\s+ at .*\b)*$';
>> if r.exec('x (A) Write a report. +ABC +DEF @John @Mary') then
>
> The (\s+\+.*\b) matches '+ABC +DEF @John @Mary'.
>
> Mattias
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
--
Luciano de Souza
More information about the fpc-pascal
mailing list