[Seaside] RxParser non standard?
Aaron Rosenzweig
aaron at chatnbike.com
Sun Aug 3 13:53:33 UTC 2014
Hi,
Is there anything newbies should know about Vassili Bykov’s RxParser? It is the de-facto tool for parsing regular expressions in Smalltalk correct?
Even the “String” class has a utility method that uses it.
Strange for it to be the de-facto standard because… it feels limiting -> see below:
I’m trying to “detect” a url so in this example:
'http://time.com/3073948/border-bill-republicians/'
allRegexMatches:
'\b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[A-Z0-9+&@#/%=~_|]’
I believe it should work. On my Mac, using “RegExRX” I tested that the expression itself is ok.
In Pharo I get “RegexMatchingError: invalid predicate selector”
When I debug into it a bit more I see:
Character(Object)>>doesNotUnderstand: #'//[-A-Z0-9+&@#/%?=~_|!’
I *assume* it is having trouble with the colons. There is a colon after the “http” part and then one in the first set of []* part right after the exclamation mark… it’s almost like it wants to treat it as if it was one of the convenience constructs like -> [:alpha:] and then obviously chokes because it is not.
doh! Has anyone run into this before?
…..
*Assuming* that we have to escape every colon when we use the RxParser I modified the code to look like this:
'http://time.com/3073948/border-bill-republicians/'
allRegexMatches:
'\b(https?|ftp|file)\://([-A-Z0-9+&@#/%?=~_|!,.;]|\:)*[A-Z0-9+&@#/%=~_|]’
I tested this in RegExRX and it is fine… but in Pharo I at least don’t get an error but I also don’t get any results! Just an empty OrderedCollection.
Does anyone have any suggestions or am I out of luck? Do I need a different regular expression tool for Smalltalk besides RxParser? Hopefully I’m just making a simple mistake.
Hopefully I’m the one who is dain bramaged.
Thanks in advance,
AARON ROSENZWEIG / Chat 'n Bike
e: aaron at chatnbike.com t: (301) 956-2319
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20140803/06f8d855/attachment.htm
More information about the seaside
mailing list