Link:http://output.to/sideway/default.asp?qno=180500016 Script, Scripting Language, VBScript elements, Server-Side VBScript RegExp Object
VBScript RegExp ObjectRegExp Object is a VBScript Object designed for providing simple regular expression support. And three Methods are provided for the manipulation of the regular expression object. Three Properties are provided for the configuartion of the regular expression object. The returns of Execute Method is a collection of matched objects, that is the Matches Collection. Additional Count Property, and Item Property are provided for accessing the Properties of Matches Collection directly. Although further properties can be accessed through dot notation, another Object called Match Object is defined for manipulating these properties of each matched object.separately.
RegExp Objectlast updated 12/10/2017is to provide simple regular expression support SyntaxSet reobjvar = New RegExp Requirement5RegExp Methodslast updated 12/11/2017Three Methods are predefined for the RegExp Object, namely, Execute Method, Replace Method, and Test Method. Dot notation is used to access the available Method for an RegExp Object, for example, reobjvar.methodname. Syntaxreobjvar.Execute(string) reobjvar.Replace(string1, string2) reobjvar.Test(string) RegExp Propertieslast updated 12/11/2017Three Properties are predefined for the RegExp Object, namely, Global Property, IgnoreCase Property, and Pattern Property. Dot notation is used to access the available Property for an RegExp Object, for example, reobjvar.propertyname. Syntaxreobjvar.Global [= True | False ] reobjvar.IgnoreCase [= True | False ] reobjvar.Pattern [= searchstring] RegExp Collectionslast updated 12/11/2017The output of the Execute Method of RegExp Object is a Collection of Match Objects, namely Matches Collection. SyntaxSet rematcolvar=reobjvar.Execute(string) RegExp.Execute Propertylast updated 12/11/2017Two Properties are predefined for the returns of Execute Method of RegExp Object, namely, Count Property, and Item Property. Dot notation is used to access the available Property for the Matches Collection returned by Execute Method of RegExp Object, for example, reobjvar.Execute(str).propertyname. Syntaxrematcolvar.Count rematcolvar.Item(key) ExamplesExamples of RegExp Object ASP VbScript Command:
HTML Web Page In-line Output:
Results on Microsoft Windows 8.1 Pro x64, Microsoft-IIS/8.5, VBScript Version 5.8 of page /internet/users/sideblog/default.asp varsstrs, TypeNameregexv.Pattern, TypeNamere, TypeNamec, TypeNameregexv.Global, TypeNameregexv.IgnoreCase, TypeNameSet regexv = New RegExp: strs="": re="": c=""[], String[], String[], String[], String[False], Boolean[False], Booleanregexv.Pattern="P": strs="PQpqPQ": re=regexv.Test(strs)[PQpqPQ], String[P], String[True], Boolean[], String[False], Boolean[False], Booleanregexv.Pattern="P": strs="PQpqPQ": c=99: re=regexv.Replace(strs,c)[PQpqPQ], String[P], String[99QpqPQ], String[99], Integer[False], Boolean[False], Booleanregexv.Global=True: strs="PQpqPQ": c=99: re=regexv.Replace(strs,c)[PQpqPQ], String[P], String[99Qpq99Q], String[99], Integer[True], Boolean[False], Booleanregexv.IgnoreCase=True: strs="PQpqPQ": c=99: re=regexv.Replace(strs,c)[PQpqPQ], String[P], String[99Q99q99Q], String[99], Integer[True], Boolean[True], Booleanstrs="PQpqPQ": Set re=regexv.Execute(strs): c=re.Count[PQpqPQ], String[P], String[IMatchCollection2], IMatchCollection2[3], Long[True], Boolean[True], Booleanregexv.IgnoreCase=False: strs="PQpqPQ": Set re=regexv.Execute(strs): c=regexv.Execute(strs).Count[PQpqPQ], String[P], String[IMatchCollection2], IMatchCollection2[2], Long[True], Boolean[False], Booleanregexv.IgnoreCase=False: strs="PQpqPQ": Set re=regexv.Execute(strs): c=regexv.Execute(strs).item(0)[PQpqPQ], String[P], String[IMatchCollection2], IMatchCollection2[P], String[True], Boolean[False], Booleanregexv.IgnoreCase=False: strs="PQpqPQ": Set re=regexv.Execute(strs): c=regexv.Execute(strs)(0)[PQpqPQ], String[P], String[IMatchCollection2], IMatchCollection2[P], String[True], Boolean[False], Booleanregexv.IgnoreCase=False: strs="PQpqPQ": Set re=regexv.Execute(strs): c=re.item(0).Length[PQpqPQ], String[P], String[IMatchCollection2], IMatchCollection2[1], Long[True], Boolean[False], Booleanregexv.IgnoreCase=False: strs="pQpqpQ": Set re=regexv.Execute(strs): c=regexv.Execute(strs).Count[pQpqpQ], String[P], String[IMatchCollection2], IMatchCollection2[0], Long[True], Boolean[False], Booleanregexv.Pattern="(\S+)(\s+)(\S+)": strs="P1Q p2q P3Q": c="$3$2$1": re=regexv.Replace(strs,c)[P1Q p2q P3Q], String[(\S+)(\s+)(\S+)], String[p2q P1Q P3Q], String[$3$2$1], String[True], Boolean[False], Boolean |
Sideway BICK Blog 16/05 |