you need to write a function that checks if the text under the cursor is a telephone number. in the code below this is checkNumber(focus) which returns a boolean.
try to implement this function using
EditField.getCursorPosition and EditField.getText (or RichtextField) to get the selected word (stringtokenizer on space maybe?).
After you got the word the cursor is positioned on you can check if it is a valid phone number.