RosettaCodeData/Task/Regular-expressions/SenseTalk/regular-expressions-1.sensetalk
2023-07-01 13:44:08 -04:00

9 lines
332 B
Text

set text to "This is a story about R2D2 and C3P0 who are best friends."
set pattern to <word start, letter, digit, letter, digit, word end>
put the sixth word of text matches pattern -- (note: the sixth word is "R2D2")
put every occurrence of pattern in text
replace the second occurrence of pattern in text with "Luke"
put text