Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!news.kei.com!newsfeed.internetmci.com!swrinde!ihnp4.ucsd.edu!munnari.OZ.AU!news.mel.connect.com.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!tmx!news.tmx.com.au!news
From: Stephan Meyn <s.meyn@oose.com.au>
Subject: Re: Basic help with Pattern class.
Message-ID: <3110276F.1011@oose.com.au>
Nntp-Posting-Host: 203.5.19.198
Sender: news@online.tmx.com.au (System Administrator)
Mime-Version: 1.0
X-Mailer: Mozilla 2.0b4 (WinNT; I)
Content-Type: text/plain; charset=us-ascii
Organization: Object Oriented Pty Ltd
Date: Thu, 1 Feb 1996 02:37:35 GMT
References: <4ekeen$4kr@newsbf02.news.aol.com>
Content-Transfer-Encoding: 7bit
Lines: 46

Joe try this 

| p s |
s := 'this is a test'.
p := (Pattern new: 'is') matchBlock: ['found' out].
s do: [:c| p match: c] 

| p s |
s := 'this is a test'.
p := (Pattern new: 'is') matchBlock: ['found' out].
(p match: s index: 1) ==->3 @ 4

| p s result |
result := WriteStream on: String new.
s := 'this is a test'.
p := (Pattern new: 'is') matchBlock: ['found' out].
p match: s index: 1 each: [:x | result nextPut: x ].
result contents ==> this

p.s.
Object>>out 
   Transcript cr;  nextPutAll:(self asString)

Stephan

JALOTTA wrote:
> 
> Greetings, I have tried, but I can't seem to get the Pattern class working
> for even the most basic things.  I am using st/v 2.0 on a Mac.  Can
> someone please tell me what I am doing wrong?
> 
> | p s |
> s := 'this is a test'.
> p := (Pattern new: 'is') matchBlock: [^true].
> p match: s.  ==> false
> 
> | p s |
> s := 'this is a test'.
> p := (Pattern new: '*') matchBlock: [^true].
> p match: s.  ==> false
> 
> | p s |
> s := 'this is a test'.
> p := (Pattern new: 'this is a test') matchBlock: [^true].
> p match: s.  ==> false
>
