note 50880 rejected from function.preg-match by nlopess
| From: | nlopess@php.net | Date: | Sat, 12 Mar 2005 22:03:40 +0000 |
| Subject: | note 50880 rejected from function.preg-match by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-86335@lists.php.net to get a copy of this message | ||
Note Submitter: alcator at seznam dot cz
----
How to strip non-alphabetic characters from the beginning and/or end of a string?
Let's say I receive a "chat" sentence "Hello, everybody, how's it going?
:-)"
I explode it by spaces into an array of strings, and then I would like to clean the words as much as
possible of anything non-alphabetic:
Hello, --> Hello
everybody --> everybody
going? --> going
:-) --> [empty]
I could live with "how's", but "hello," is causing me some problems.
Any idea?
Thanks in advance