This discussion is archived
9 Replies Latest reply: Mar 30, 2007 11:43 AM by 807606 RSS

regular expressions for replacing text with sms language text

807606 Newbie
Currently Being Moderated
Hi, I'm trying to write a function which converts normal, correctly spelled text into the shorter sms language format but struggling to come up with the regular expressions i need to do so, can anyone help?
----------------------------------------------------------------------------------
1: remove surplus white space at the beginning of a sentence and at the end of a sentence.
e.g. " hello." --> "hello." OR "hello ." --> "hello."

2: remove preceeding and/or proceeding space if there's a word then a number possibly followed by another word
e.g. "come 2 me" --> "come2me" OR "dnt 4get" --> "dnt4get"

3: remove "aeiou" if word starts and ends with "!aeiou"
e.g. "text" --> "txt"