RosettaCodeData/Task/Regular-expressions/Smalltalk/regular-expressions-2.st
2019-09-12 10:33:56 -07:00

7 lines
164 B
Smalltalk

|re s s1|
re := 'm[a-z]+ing' asRegex.
s := 'this is a matching string'.
(re search: s) ifTrue: [ 'matches!' ].
s1 := re copy: s replacingMatchesWith: 'modified'.