Fwd: [Pharo-project] matchesRegex: multiline

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

Fwd: [Pharo-project] matchesRegex: multiline

Nick
There's a discrepancy between Pharo regex parsing and Gemstone. See below.


I see in the repository: http://seaside.gemstone.com/ss/VBRegex the regex version is:

-------------
Ancestors: VB-Regex-STA.19
===========================

Name: VB-Regex-STA.19
Author: STA
Time: 09/30/2009, 13:30:54
UUID: 64d7bb43-f1cf-49fb-8419-c3a1fca0ba28
Ancestors: VB-Regex-kdt.18

Initial upload of Ken Tries' port.
------------


I'm not sure how that relates to the versions in the Pharo repository: http://www.squeaksource.com/Pharo

I've worked round the problem and in the meantime I've filed an issue: http://code.google.com/p/glassdb/issues/detail?id=166

Nick


---------- Forwarded message ----------
From: Nick Ager <[hidden email]>
Date: 31 August 2010 09:56
Subject: Re: [Pharo-project] matchesRegex: multiline
To: [hidden email]


> Is there a way to allow the regex '.' (dot) to match line break characters:
> 'hello regex' matchesRegex: '.*regex'    "true"
> 'hello
> regex' matchesRegex: '.*regex'    "false"
 
In my image the second expression returns true as well.


In fact the '.' (dot) matches anything but the null character (see
RxMatcher>>#syntaxAny).

Thanks - I shouldn't make assumptions - it matches in Pharo but not in Gemstone - I assumed the implementations would be identical. 

As you say the culprit is RxMatcher>>#syntaxAny

In Pharo:

RxMatcher>>#syntaxAny
^RxmPredicate new
predicate: [:char | char asInteger ~= 0]


In Gemstone:

RxMatcher>>#syntaxAny
^RxmPredicate new
predicate: [:char | (Cr = char or: [Lf = char]) not]

Nick