Anonymous user
Regular expressions: Difference between revisions
→{{header|Smalltalk}}: classify existing code as GNU Smalltalk; add pharo
(→{{header|Smalltalk}}: classify existing code as GNU Smalltalk; add pharo) |
|||
Line 2,164:
=={{header|Smalltalk}}==
{{works with|GNU Smalltalk}}
<lang smalltalk>|re s s1|
re := Regex fromString: '[a-z]+ing'.
Line 2,183 ⟶ 2,184:
(s replacingRegex: re with: 'modified') displayNl.</lang>
{{works with|Pharo}}
<lang 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'.
</lang>
=={{header|SNOBOL4}}==
|