04.06.2008, 02:06 | #1 |
Участник
|
axaptapedia: Regular expressions
Источник: http://www.axaptapedia.com/Regular_expressions
============== Summary: /* Internal */ There are two kind of [http://www.regular-expressions.info/ regular exressions] you can use in Ax === Internal === You can use the [[match function]] to chack whether string matches a regular exression or [[TextBuffer class]] to find a substring which matches reqular expression. Internal regexes have a very special syntax, which is described in a help for the match function in Ax 3. boolean isCorrectPhone(str _s) { return match('', _s); } === Reference (to be reformatted ) === Compares the fixed expression specified by pattern with the text string specified by text. The system does not differentiate between lower and upper case. A combination of fixed expressions is in itself a fixed expression. The following special characters can be used to create the pattern in the fixed expression: \ A backslash causes a specific character to be matched. For example, "\$" matches a dollar sign. < or ^ A 'less than'( or & A 'greater than'(>) sign or an ampersand (&) at the end of the expression is used to match the end of a line. ? or . A question mark (?) or a full stop (.) will match any character (except Enter, new line). :x A colon specifies a group of characters to be matched, indicated by the character which follows immediately after. :a Sets the match to letters :d Sets the match to numeric characters :n Sets the match to alphanumeric characters :SPACE Sets the match to blanks, tabulations, and control characters such as Enter (new line). * An expression followed by an asterisk requires a match for none or several occurrences of the expression. For example, "fo*" will locate "f", "fo", "foo" etc. + An expression followed by a plus (+) sign requires a match for one or several occurrences of the expression. For example, "fo+" matches "fo" etc. - An expression followed by a minus (-) sign requires a match for no or one occurrence of the expression. For example, "fo-" matches "f" and "fo". [] A string of characters enclosed within square brackets specifies that a match is required for every character in this text, and only for these characters. For example, "[xyz]" matches "xx" and "zyx" etc. A string of characters can be specified by two characters separated by '-' (minus). For example, "[a-z]" matches all letters, whereas "[z-a]" never matches. [^] If the first character in a text within square brackets is a circumflex (^) then the expression matches all characters except Enter (new line) and the characters in the string. For example, "[^xyz]" matches "abc" but not "axb". Выходное значение === External === You can use more rich regexes via COM in Ax 3 or .NET in Ax 4 Ax 4 business code uses System.Text.Regex for many purporses such as email validation ( \Classes\SysEmailDistributor\validateEmail ) === See also === [http://blogs.msdn.com/palle_agermark...nd-dialog.aspx Palle Agermark's WebLog : Use regular expressions in the Find dialog] Источник: http://www.axaptapedia.com/Regular_expressions
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|