Flex正则表达式,以及RegExpValidator验证多个文本框等

xiaoxiao2026-06-11  13

一,正则表达式的表示 <mx:RegExpValidator id="regExpV" property="text" required="false" expression="{'^\\w\{4,20\}$'}" noMatchError="格式错误,请使用数字字母下划线字符,长度在4-20"> </mx:RegExpValidator> 1,注意转义字符,\要变成\\,{}要加\转义 2,注意在mxml中的字符串表示 3,更多参考Flex-ref的RegEx 4.正则表达式在线测试工具 http://regexpal.com/ 二,验证器支持多个文本框等,不仅限RegExpValidator,文本框,其他验证器同理可行 加入,在文本框属性中加入 focusIn="regExpV.source=txtOldPassword;" 完整如下: <mx:TextInput id="txtPassword" text="{editableInfo.password}" displayAsPassword="true" focusIn="regExpV.source=txtPassword;"/> 相关资源:日期验证的正则表达式很好用
转载请注明原文地址: https://www.6miu.com/read-5049978.html

最新回复(0)