YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

bug on regular expression
Shimarisu
#1 Posted : Saturday, March 22, 2008 1:25:26 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/22/2008(UTC)
Posts: 2

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
I thank for your great work.


by the way, I found a bug on the Squirrel's regular expression library.
please check the following code.


1:
local text = "ab abcd ab";
re <- regexp("a.*b");
local ret = re.search(text);
print("begin, end = " + ret.begin + ", " + ret.end + "\n");
print("ret = " + text.slice(ret.begin,ret.end) + "\n");


result:
> begin, end = 0, 5
> ret = ab ab


I think that should match "ab abcd ab".


2:
local text = "abcdefg";
re <- regexp("a.*b");
local ret = re.search(text);


result:
ret is null.


I think that should match only "ab".


thanks for reading.


Shimarisu

fagiano
#2 Posted : Saturday, March 22, 2008 5:24:37 AM(UTC)
Rank: Advanced Member

Groups: Registered, Administrators
Joined: 6/11/2005(UTC)
Posts: 1,054

Thanks: 0 times
Was thanked: 77 time(s) in 59 post(s)
Hi, yes, I know the regex library greedyness is all wrong, at least it doesn't behave as a posix regexp. More than a bug was my design mistake from start. To fix this kind of behaviour it would require a full rewrite.


Alberto

Follow me on Twitter @squirrellang
Shimarisu
#3 Posted : Sunday, March 23, 2008 9:53:33 PM(UTC)
Rank: Member

Groups: Registered
Joined: 3/22/2008(UTC)
Posts: 2

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Thanks for reply.
I hope it will be repaired sometime =)
renshijun
#4 Posted : Sunday, January 8, 2017 2:23:27 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 12/26/2014(UTC)
Posts: 30
Location: Harbin, China

Thanks: 1 times
Was thanked: 0 time(s) in 0 post(s)
the behaviour is all the same. no improvement now.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Clean Slate theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.105 seconds.