开发者

Flex TextInput restrict: Restrict punctuation

开发者 https://www.devze.com 2023-03-26 16:22 出处:网络
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:

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, "_");
0

精彩评论

暂无评论...
验证码 换一张
取 消