Anonymous user
Regular expressions: Difference between revisions
Add Racket entry
(→{{header|Ruby}}: Clean up, Rubyfy, and fix examples) |
(Add Racket entry) |
||
Line 1,280:
<lang R>gsub(pattern, "pair of socks", c(text1, text2))</lang>
[1] "this is a matching pair of socks" "this does not match"
=={{header|Racket}}==
<lang lisp>
#lang racket
(define s "I am a string")
(when (regexp-match? #rx"string$" s)
(displayln "Ends with 'string'."))
(unless (regexp-match? #rx"^You" s)
(displayln "Does not start with 'You'."))
(displayln (regexp-replace " a " s " another "))
</lang>
=={{header|Raven}}==
|