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