|
Regular Expression Question: msg#00124lang.smalltalk.squeak.beginners
Hi everyone, I am new to smalltalk and have been having trouble using regular expressions. I have installed Vassili Bykov’s RegEx package using the Monticello Browser. Here is what my issue is. I have a test string that I want to "push" into an OrderedCollection. testString := 'this is a test'. testCollection := '(^\s*)|(\s)|\w+' asRegex matchesIn: testString. Now I can inspect this in a workspace and it shows me an ordered collection of all the elements of the string. However when I attempt to use this in a method, and call the method from a TestCase, I get an infinite loop. Stepping through the method I found that the "asRegex" portion of the statement above works correctly. Where is seems to be crashing is in the "matchesIn:" method. Can anyone please let me know what I am missing? The exact statements in my test case are: | myTokens myString| self halt. myTokens := OrderedCollection new. myString := 'this is a test'. myTokens := '(^\s*)|(\s)|\w+' asRegex matchesIn: myString. self shouldnt: [myTokens isEmpty]. If you step through this method in the Test Runner you will see it never makes it through the matchesIn: method. Am I forgetting to instantiate something? -- View this message in context: http://www.nabble.com/Regular-Expression-Question-tp15068867p15068867.html Sent from the Squeak - Beginners mailing list archive at Nabble.com.
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: is* methods, Michael Rueger |
|---|---|
| Next by Date: | Re: One click setup for 3.9 [win], valente |
| Previous by Thread: | is* methods, Blake |
| Next by Thread: | Re: Regular Expression Question, Zulq Alam |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |