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

12 lines
346 B
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

set phoneList to {{
Harry Potter 98951212
Hermione Granger 59867125
Ron Weasley 56471832
}}
set wordPattern to <word start, characters, word end>
set namePattern to <start of line, {firstName: wordPattern}, space, {lastName: wordPattern}>
replace every occurrence of namePattern in phoneList with "{:lastName}, {:firstName} "
put phoneList