Re: Bug in Regex?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Bug in Regex?

GLASS mailing list
BTW, I am CCing GemStone mailing list too because it answers false there too. 

On Wed, Feb 20, 2019 at 5:26 PM Mariano Martinez Peck <[hidden email]> wrote:
Hi guys, 

Look at this case:

`'25' matchesRegex: '([0-9]|[1-9][0-9])' -> false`
`'25' matchesRegex: '([1-9][0-9]|[0-9])' -> true`

That is, ( a | b ) is not euqal to ( b | a ) " a or b is not equal to b or a" and should describe a range of 0 to 99.

I don't understand why the first sentence answers false. Even Pharo 1.1 answers false (so this is very very old behavior). I checked on other dialects and it answers true. I then checked here [1] and it also find matches.

So...do you see some rational explanation or sounds like a bug? 


--


--

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Bug in Regex?

GLASS mailing list
And..as Esteban Maringolo points out, it also happens with sequence of chars...

'bb' matchesRegex: '([a-z]|[b-z][a-z])' --> false.

Cannot be simpler than this:

'25' matchesRegex:  '(\d\d|\d)' --> true
'25' matchesRegex:  '(\d|\d\d)' --> false 

So there is something related to the OR.

Thoughts?



On Wed, Feb 20, 2019 at 5:33 PM Mariano Martinez Peck <[hidden email]> wrote:
BTW, I am CCing GemStone mailing list too because it answers false there too. 

On Wed, Feb 20, 2019 at 5:26 PM Mariano Martinez Peck <[hidden email]> wrote:
Hi guys, 

Look at this case:

`'25' matchesRegex: '([0-9]|[1-9][0-9])' -> false`
`'25' matchesRegex: '([1-9][0-9]|[0-9])' -> true`

That is, ( a | b ) is not euqal to ( b | a ) " a or b is not equal to b or a" and should describe a range of 0 to 99.

I don't understand why the first sentence answers false. Even Pharo 1.1 answers false (so this is very very old behavior). I checked on other dialects and it answers true. I then checked here [1] and it also find matches.

So...do you see some rational explanation or sounds like a bug? 


--


--


--

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Bug in Regex?

GLASS mailing list
What a good case to have GToolkit visualizations help debugging this RX tree ;)

Regards!


Esteban A. Maringolo


El mié., 20 feb. 2019 a las 17:44, Mariano Martinez Peck via Glass (<[hidden email]>) escribió:
And..as Esteban Maringolo points out, it also happens with sequence of chars...

'bb' matchesRegex: '([a-z]|[b-z][a-z])' --> false.

Cannot be simpler than this:

'25' matchesRegex:  '(\d\d|\d)' --> true
'25' matchesRegex:  '(\d|\d\d)' --> false 

So there is something related to the OR.

Thoughts?



On Wed, Feb 20, 2019 at 5:33 PM Mariano Martinez Peck <[hidden email]> wrote:
BTW, I am CCing GemStone mailing list too because it answers false there too. 

On Wed, Feb 20, 2019 at 5:26 PM Mariano Martinez Peck <[hidden email]> wrote:
Hi guys, 

Look at this case:

`'25' matchesRegex: '([0-9]|[1-9][0-9])' -> false`
`'25' matchesRegex: '([1-9][0-9]|[0-9])' -> true`

That is, ( a | b ) is not euqal to ( b | a ) " a or b is not equal to b or a" and should describe a range of 0 to 99.

I don't understand why the first sentence answers false. Even Pharo 1.1 answers false (so this is very very old behavior). I checked on other dialects and it answers true. I then checked here [1] and it also find matches.

So...do you see some rational explanation or sounds like a bug? 


--


--


--
_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Bug in Regex?

GLASS mailing list


On Wed, Feb 20, 2019 at 5:56 PM Esteban Maringolo via Glass <[hidden email]> wrote:
What a good case to have GToolkit visualizations help debugging this RX tree ;)


Oh yeah..And look Doru, they have some stuff on the top right "Explanation" panel: https://regex101.com/r/MqVXz8/1


--

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass