help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] problem with regex usage


From: dragoncity
Subject: [Help-smalltalk] problem with regex usage
Date: Sat, 27 Sep 2008 22:43:50 -0700 (PDT)

The following VWST code works fine, however in trying to convert to gst I
cannot find much help
in changing the REGEX line of code.

The problem is to extract all the integers from a text line and sort into
order and print, and NO its not a class test :-),
just a example of string manipulation from a  C++ site I think.

I've tried replaceAllRegex:with: and am getting a doesNotUndertstand error
In the small extraction below I'm simply trying to get a regex to suppress (
replace)
any alphas with a space -- without sucess !!

============= gst test =========================
| txt nums |

Transcript cr; show: '*** hiddennumbers.ws '; show: Time now printString ;
cr.
txt := '098m03r9f80239802389f0m9KDKLKLJDKLJm0983m890DMOm03 
dlkfj3hljf4h3klhl00000002998'.

Transcript cr; show: txt ; cr.
" //  txt :=    txt copyWithRegex: '[a-zA-Z]' matchesReplacedWith: ' '.  " "
vwst code "

txt := txt replaceAllRegex: '[a-zA-Z]'  with: ' '.                              
          
" gst code "
                                  " replace all alphas with space "
Transcript cr; show: txt ; cr.
========================= execution ====================

$ gst -f hiddennumbers.st

*** hiddennumbers.ws 15:38:46

098m03r9f80239802389f0m9KDKLKLJDKLJm0983m890DMOm03 
dlkfj3hljf4h3klhl00000002998
Object: '098m03r9f80239802389f0m9KDKLKLJDKLJm0983m890DMOm03 
dlkfj3hljf4h3klhl00000002998' error: did not understand
#replaceAllRegex:with:
MessageNotUnderstood(Exception)>>signal
String(Object)>>doesNotUnderstand: #replaceAllRegex:with:
UndefinedObject>>executeStatements

098m03r9f80239802389f0m9KDKLKLJDKLJm0983m890DMOm03 
dlkfj3hljf4h3klhl00000002998
$
================================================

-- 
View this message in context: 
http://www.nabble.com/problem-with-regex-usage-tp19709076p19709076.html
Sent from the Gnu - Smalltalk mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]