Andrew C. Greenberg wrote:
I have just finished a preliminary version of a plugin
linking Sqeueak to the most recent version of Philip Hazel's excellent PCRE regular expressions library. (The Python Regular Expression functionality was derived from an earlier version of this library.)
The following examples are illustrative:
'a.*c' reSearch: 'xxxxxxxxx' evaluates to: nil ('a.*c' reSearch: 'xxxaxxxcxxx') match evaluates to: 'axxxc' ('a(.*)c' reSearch: 'xxxxabbbbcxxx') matchAt: 1 evalutates to: 'bbbb' ('\w+' reGsearch: 'this is a test' ) collect: [:m | m match] evaluates to: OrderedCollection ('this' 'is' 'a' 'test' ) '\w+' reGsearch: 'this is a test' sub: [:m | '<', (m match), '>'] evaluates to: '<this> <is> <a> <test>'
To install the plugin:
(1) download and unpack: ftp://ftp.gate.net/pub/users/werdna/rePluginMacPPC2.3a.sit (2) Copy the changeset, the plugin and the file entitled
'regular expressions' to your squeak directory.
(3) Start squeak and fileIn the changeset. There is some
documentation in the comments for classes ReMatch and RePattern. A more complete discussion of the regular expressions used in the library can be found by executing the following:
(FileStream oldFileNamed: 'Regular Expressions') edit
The published plugin is setup for Mac PPC only at this time. I believe it should be fairly straightforward to port it to other platforms, and would be pleased to encourage and assist anyone who wishes to do so.
I would give it a try if someone would provide a compressed tar package ....
Markus