Wednesday, September 29, 2010

VBScript Pattern Properties



Pattern Properties

Sets or returns the regular expression search mode.

object.Pattern [= searchstring]

Parameter
object

Required. Is always a RegExp object variable.

searchstring

Available options. By regular string expression search. It may contain some form to set the regular expression in a variety of characters.

Set up

In writing the regular expression pattern used special characters and sequences. The following table describes the characters and sequences can be used, and gives examples.

Character Description
Will be the next character is marked as a special character or literal. For example, with the character n n match. n with newline matches. Sequence \ and match, (and (match.
^ Matches the beginning of the input.
$ Matches the end.
* Matches the preceding character zero or a few times. For example, zo * matches z, zoo.
+ Matches one or more times the previous character. For example, zo + can match the zoo, but does not match the z.
? Match the previous character zero or one. For example, a? Ve? Can never match the ve.
. Matches any character other than newline.
(Pattern) and pattern matching and remember the match. Matched substring can be as a result of the Matches collection using the Item [0 ]...[ n] to obtain. To match parentheses characters (and), use (or).
x | y matches x or y. For example, z | food can match the z or food. (Z | f) oo match the zoo or the food.
(N) n non-negative integers. Match exactly n times. For example, o (2) can not be matched with Bob in the o, but can foooood o in the first two matches.
(N,) n non-negative integers. Match at least n times. For example, o (2,) does not match Bob's o, but the match foooood all of the o. o (1,) is equivalent to o +. o (0,) is equivalent to o *.
(N, m) m and n non-negative integers. Match at least n times, at most m times. For example, o (1,3) matches fooooood in the first three o. o (0,1) is equivalent to o?.
[Xyz] A character set. And one of the characters in parentheses matching. For example, [abc] matches the plain in a.
[^ Xyz] A negative character set. This does not match any character in brackets. For example, [^ abc] can match the plain in the p.
[A-z] that a range of characters. Within the specified range matches any character. For example, [az] match between a and z any lowercase characters.
[^ M-z] in the negative range characters. And not in the specified range of characters matched. For example, [mz] m to z and not on any of the characters between the matches.
b and the word boundary matching, that is, the location between the words and spaces. For example, erb er and never in the match, but does not match the verb in the er.
B and non-word boundary matching. ea * rB and never early match in the ear.
d with a number of character match. Is equivalent to [0-9].
D matches with non-numeric characters. Is equivalent to [^ 0-9].
f and page breaks match.
match n with newline characters.
r and carriage return characters match.
s matches any white characters, including spaces, tabs, page breaks and so on. Is equivalent to [fnrtv].
S and any non-blank character match. Is equivalent to [^ fnrtv].
t match with the tab.
match v with vertical tabs.
w matches any word character including underscore. Is equivalent to [A-Za-z0-9_].
W matches any non-word character. Is equivalent to [^ A-Za-z0-9_].
num num match, of which num is a positive integer. Reference back to remembered matches. For example, (.) 1 matches two consecutive identical characters.
n match n, where n is an octal escape value. Octal escape values must be 1, 2 or 3 digits long. For example, 11 and 011 are matched with a tab. 0011 is equivalent to 001 and 1. Octal escape values must not exceed 256. Otherwise, only the first two characters are treated as part of an expression. Allows the use of regular expressions ASCII code.
xn match n, where n is a hexadecimal escape value. Hexadecimal escape values must be exactly two digits long. For example, x41 Match A. x041 is equivalent to the x04 and 1. Allows the use of regular expressions ASCII code.

Explain

The following code illustrates the use of Pattern attributes:

Function RegExpTest (patrn, strng) Dim regEx, Match, Matches''to establish variable. Set regEx = New RegExp''to establish a general expression. regEx.Pattern = patrn''set the pattern. regEx.IgnoreCase = True''settings are case-sensitive. regEx.Global = True''set the global availability. set Matches = regEx.Execute (string)''Repeat match set RegExpTest = regEx.Execute (strng)''perform a search. for each match in matches''Repeat match set RetStr = RetStr & Match found at position RetStr = RetStr & Match.FirstIndex &. Match Value is''RetStr = RetStr & Match.Value &''.& vbCRLF NextRegExpTest = RetStrEnd FunctionMsgBox (RegExpTest (is., IS1 is2 IS3 is4))







Recommended links:



Recommend E-Commerce



Using photoshop build a passion Miyi chocolate effect



Delphi beginners reference (b)



VOB to MPG



Wait Mature open source model



UbeeInteractive Opening Of The New Company Name



Flex: ADOBE'S "free lunch"



BEST Search Or Lookup Tools



18 Interpretation of retail display as rule Specifications



Consumer NAS Me And You?



MP4 to Flash



VOB to Zune



The Basis Of How Effective Management Of



Matting, Photoshop master of The Road, 2



E-cology In The Pan Micro Series 29



No comments:

Post a Comment