Hello @Mr.H and welcome to the Community!
There are few ways how to separate names and numbers in this case:
-
Use the keepchars(), removechars() functions to keep/remove only digits. For instance:
removechars("Doe, John 12345678", "0123456789") returns "Doe, John " keepchars("Doe, John 12345678", "0123456789") returns "12345678"
Or,
-
Use the keepafter() and keepbefore() functions, to keep parts of text before or after a separator (such as space). The functions have recently received a new syntax (the help articles are not updated yet) that allows specifying a separator entry other than the first from the beginning. For instance:
keepbefore("Doe, John 12345678", " ", -1) returns "Doe, John" keepafter("Doe, John 12345678", " ", -1) returns "12345678"
The negative 3rd argument in this case indicates the 1st separator entry from the end.
See the example below.
separate-text.morph (3.3 KB)