[Seaside] Re: RxParser non standard?

Dirk Newbold dirkdirk at gmail.com
Thu Aug 7 03:36:52 UTC 2014


This worked for me...

'http://time.com/3073948/border-bill-republicians/'
allRegexMatches: '\b(https?|ftp|file)[:]//[-a-zA-Z0-9+&@
#/%?=~_|!:,.;]*[a-zA-Z0-9+&@#/%=~_|]'

Just add [] around : and included lowercase a-z

For your reference

Cincom VW7.9
RxParser class side method #c:_ syntax:__



On Sun, Aug 3, 2014 at 11:53 PM, Aaron Rosenzweig <aaron at chatnbike.com>
wrote:

> 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 <http://www.chatnbike.com>
> *e:*  aaron at chatnbike.com  *t:*  (301) 956-2319   [image: Chat 'n Bike]  [image:
> Chat 'n Bike]
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20140807/9a615224/attachment.htm


More information about the seaside mailing list