tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
18
Task/Regular-expressions/Smalltalk/regular-expressions.st
Normal file
18
Task/Regular-expressions/Smalltalk/regular-expressions.st
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
|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.
|
||||
Loading…
Add table
Add a link
Reference in a new issue