I need to send SMS to the user, before send the message I want remove the unsupported characters from the message. I added my API documentation lines as the reference.
Generally speaking, only a subset of the standard ASCII character set is supported for content being delivered to the user via SMS. The list of supported characters are A-Z, a-z, 0-9 and the following:
@$_/.,"():;-=+*&%#!?<>'plus space and newline"\n".Most special characters are not supported and will cause messages to be rejected by the wireless operators. In particular, accented characters and the following are NOT supported:
tab
[]~{}^|€\When authoring content for delivery via SMS, it is also important to use the simple ASCII characters for the apostrophe, the ellipsis, and single and double quotes:
use
'instead of<`>and<’>use
"instead of<“>and<”>use
...instead of…(Note: that’s three separate periods instead of the single ellipsis character)
So I’m looking for regular expression to satisfy this requirement.
You could replace all characters that don’t match the valid ones:
The
[]means: “any of” and the^means: “not”. So the whole expression says: Match anything but…So you’d write:
For further information (and your further questions ;-)) please have a look at this Howto.