rzel / kahlua

Automatically exported from code.google.com/p/kahlua
0 stars 0 forks source link

brackets in regular expressions don't work #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

s = "Hello"
assertEqual(s:match("H[e][lo][lo][lo]"),"Hello")
assertEqual(s:find("[hello][hello][hello]"),2)

What is the expected output? What do you see instead?

[java] Failed: /home/matejcik/gps/kahlua/testsuite/bin/lua/string.lbc:
expected 2, actual nil
(for the latter; for the former, it's "expected Hello, actual nil")

What version of the product are you using? On what operating system?

r112

Please provide any additional information below.

Last time i investigated this, it appeared that brackets are considered
captures (which is wrong). I didn't read the code since true captures were
introduced; now it appears that brackets don't work at all.

Original issue reported on code.google.com by matej...@gmail.com on 24 Nov 2008 at 5:57

GoogleCodeExporter commented 8 years ago
I've fixed the issue in the newest revision i hope.  your find test that you 
included
here was a bit off though; i modified it as follows and put it in the string 
test suite:

assertEqual(s:find("[Hello][Hello][Hello]"),1)

Original comment by KevinRLu...@gmail.com on 25 Nov 2008 at 3:44

GoogleCodeExporter commented 8 years ago

Original comment by KevinRLu...@gmail.com on 25 Nov 2008 at 3:45

GoogleCodeExporter commented 8 years ago

Original comment by KevinRLu...@gmail.com on 25 Nov 2008 at 3:45

GoogleCodeExporter commented 8 years ago
yes, it appears to work now, thanks
(btw my test was correct, it was just testing different part of the string ;) ) 

Original comment by matej...@gmail.com on 25 Nov 2008 at 11:58

GoogleCodeExporter commented 8 years ago
i realized that after i posted, i'll add that test back in next time i make a 
change :)

Original comment by KevinRLu...@gmail.com on 25 Nov 2008 at 6:03

GoogleCodeExporter commented 8 years ago
btw i tried to change the first test to s:match("H[e][lo]+") and found out that 
'+'
and '*' don't work (yet), should i report that too or should i just wait?

Original comment by matej...@gmail.com on 25 Nov 2008 at 6:20

GoogleCodeExporter commented 8 years ago
The different accumulators (?,*,+,-) are what i'm working on next, so you don't 
need
to log that.

Original comment by KevinRLu...@gmail.com on 25 Nov 2008 at 7:03