Jump to content

Regular expressions: Difference between revisions

→‎{{header|Tcl}}: ++ smalltalk
(Vedit macro language added)
(→‎{{header|Tcl}}: ++ smalltalk)
Line 454:
"was"
end)
 
=={{header|Smalltalk}}==
 
<lang smalltalk>|re s s1|
re := Regex fromString: '[a-z]+ing'.
s := 'this is a matching string'.
s1 := 'this does not match'.
 
(s =~ re)
ifMatched: [ :b |
b match displayNl
].
(s1 =~ re)
ifMatched: [ :b |
'Strangely matched!' displayNl
]
ifNotMatched: [
'no match!' displayNl
].
 
(s replacingRegex: re with: 'modified') displayNl.</lang>
 
=={{header|Tcl}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.