#1 2018-02-22 19:34:27

zed
Member
From: Belarus
Registered: 2015-02-26
Posts: 105

Pattern match failed

Test code:

IsMatch('ab*.[ef]xyz', 'ab.exyz', True);
IsMatch('ab*.[ef]xyz', 'abcd.exyz', True);
IsMatch('ab*.[ef]xyz', 'ab.fxyz', True);
IsMatch('ab*.[ef]xyz', 'abcd.fxyz', True);

all failed!

mORMot version: 1.18.4332.
Compiler: Delphi 2007.

Last edited by zed (2018-02-22 19:37:16)

Offline

#2 2018-02-22 22:13:28

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,654
Website

Re: Pattern match failed

Did you find out why?

Also the following fails:

  Check(IsMatch('ab.[ef]xyz', 'ab.exyz', True));
  Check(IsMatch('ab[ef]xyz', 'abexyz',true));

But this one works:

  Check(IsMatch('ab[ef]xyz', 'abexyz',false));

Offline

#3 2018-02-23 11:24:56

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,654
Website

Re: Pattern match failed

Offline

#4 2018-02-23 19:19:26

zed
Member
From: Belarus
Registered: 2015-02-26
Posts: 105

Re: Pattern match failed

Yes, it helps.

But here is a new fail:

Assert(not IsMatch('ab[cd]e', 'abdde', False)); // ok
Assert(not IsMatch('ab[cd]ex', 'abddex', False)); // ok

Assert(not IsMatch('ab*.[cd]e', 'ab.dde', False)); // ok
Assert(not IsMatch('ab*.[cd]ex', 'ab.ddex', False)); // fail

Offline

#5 2018-02-23 21:29:19

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,654
Website

Re: Pattern match failed

Another one....
sad

Please check https://synopse.info/fossil/info/f27ae4bd52

Thanks a lot for the feedback!

Offline

#6 2018-02-23 21:52:06

zed
Member
From: Belarus
Registered: 2015-02-26
Posts: 105

Re: Pattern match failed

Ok, now it's work. Thank you!

Last edited by zed (2018-02-23 21:52:25)

Offline

#7 2018-02-24 09:34:08

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: Pattern match failed

This sounds like a simplified regular expression, cool! And I didn't know about it before.

PS, not a real issue, but I couldn't resist - I thought it should be placed in SynCommon.pas instead?


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#8 2018-02-24 18:19:32

Junior/RO
Member
Registered: 2011-05-13
Posts: 210

Re: Pattern match failed

Yeah, SynCommons is a better place

Offline

#9 2018-02-24 19:01:19

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,654
Website

Re: Pattern match failed

It was in SynCommons.pas but the file is so big it became more than 65535 lines... which makes the Delphi compiler fails... Delphi 5 compiler, but to be honnest... wink

Check the explanation at the beginning of SynTable.pas.

Offline

#10 2018-02-24 19:25:58

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: Pattern match failed

Please,  do not grow a SynCommons.  It's already big enough. For example I can't even view it on github or give someone a HTTP link to the line of code when answer a question.  I vote to split it into parts.

Online

#11 2018-02-24 21:46:50

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Re: Pattern match failed

+1 for splitting SynCommons

Offline

#12 2018-02-25 03:27:02

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: Pattern match failed

I didn't take into account the unit file size when I was thinking about it, just thought about it logically wink


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

Board footer

Powered by FluxBB