Regex with Quantifiers

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

Regex with Quantifiers

jtuchel
This post was updated on .
It seems Pharo's Regex package does support quantifiers, but not correctly. Or I am completely on the wrong track here.
If I inspect this in a workspace:

'123' matchesRegex: '\d{1,3}'

I would expect the result either to be true or an exception. True if quantifiers were supported, an exception otherwise. The Regex-Tests do not test {}, so I am not sure if the matcher is supposed to support it.

I used Pharo 2.0 for this test.

Can anybody shed some light on this?

Joachim
Reply | Threaded
Open this post in threaded view
|

Re: Regex with Quantifiers

jtuchel
Hi again,

I just found the PBE2 - chapter on Regex.
First of all: That is an excellent chapter, thanks a lot guys for writing and providing it!!!

It doesn't mention {} quantifiers, so I guess it is simply a feature too new in Regexes for it to be supported by Vassily's Regex code.

So I started a new tiny experiment:

'123{' matchesRegex: '\123{' --> true

which means the regex matcher treats { as a normal character. I guess this is okay with Regex 1.1, a version that didn't know {} quantifiers, right?

Is anybody aware of a Regex matcher in Smalltalk that supports a newer Regex version?

I am asking because in an application I need to process an impressive set of business rules provided by a third party that is expressed with lots of regexes. It would be nice if I could simply use these expressions uniformly for both HTML5 input fields and my Server application in Seaside...


Joachim