I have need to restrict user input. TextInput should 开发者_高级运维restrict all special characters and punctuation. Any other characters are allowed. In java there is a regex patter:
replaceAll("\\p{Punct}", "_")
Is there something similar in actionscript?
Use the restrict property:
<s:TextInput restrict="a-z0-9" />
This should be the equivalent of {Punct}
string = string.replace(/[!"#$%&'()*+,-.\/:;<=>?@[\]^_`{|}~]/ig, "_");
精彩评论