[Q] RePlugin
Ned Konz
ned at bike-nomad.com
Thu Dec 19 17:36:24 UTC 2002
On Thursday 19 December 2002 07:47 am, Chris Burkert wrote:
> My question is how to get subelements of a Match. In some other
> languages I was used to get this via () and access this in the
> returned array. In Squeak it seems to me that there is some
> different behaviour.
>
> re _ '<!--\s*INCLUDE\s+(.*)\s*-->'.
> st _ 'foo <!-- INCLUDE ../path/to/file.tpl--> bar'.
> (st reMatch: re) inspect
>
> This way I can allow to split a HTML-Template-File in more than
> one. But how do I get the path without the comment around ?
Andrew has provided excellent documentation in the class comments of
Re and ReMatch. Please read them.
Anyway,
re _ '<!--\s*INCLUDE\s+(.*)\s*-->'.
st _ 'foo <!-- INCLUDE ../path/to/file.tpl--> bar'.
(st reMatch: re) matchAt: 1
returns '../path/to/file.tpl'
--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
More information about the Squeak-dev
mailing list
|