下 載 Download the regexp.fll
使用說明:
CLEAR
*!* Let Visual FoxPro know about the new function *!* by setting the library to the regexp.fll
SET LIBRARY TO LOCFILE("regexp.fll","FLL","Locate regexp.fll")
LOCAL lcExpression
*!* Validate Email addresses
lcExpression = "^( + )* +@( + )+ {2,6}$"
?RegExp(" john@isp.com",lcExpression )
?RegExp(" john@.isp.com",lcExpression )
*!* Validate currency amounts
lcExpression = "^(\$)?(( \d{0,2}(\,\d{3})*)|( \d*)|(0))(\.\d{2})?$"
?RegExp("$1,244,311.81",lcExpression) && Match
?RegExp("$1,24,4311.81",lcExpression) && No Match
*!* Validate days of the week
lcExpression = "^(Sun|Mon|(T(ues|hurs))|Fri)(day|\.)?$|Wed(\.|nesday)?$|Sat(\.|urday)?$|T((ue?)|(hu?r?))\.?$"
?RegExp("Sunday",lcExpression) && Match
?RegExp("sundae",lcExpression) && No Match
*!* Validate phone numbers
lcExpression = "^ \d{2}-\d{3}-\d{4}$"
?RegExp("507-562-0020",lcExpression) && Match
?RegExp("507-56-0020",lcExpression) && No Match
*!* release the library reference
SET LIBRARY TO
沒有留言:
張貼留言