Sideway BICK BlogSideway BICK BLOG from Sideway

A Sideway to Sideway Home

Link:http://output.to/sideway/default.asp?qno=180500017

Script, Scripting Language, VBScript elements, Server-Side VBScript Object Element RegExp Method

VBScript Methods of RegExp Object

Some typical predefined Elements are.

  • RegExp Object:
    • Execute Method
    • WriteLine Method

Execute Method

last updated 12/11/2017

is to executes a regular expression search against a specified string.

Syntax

reobjvar.Execute(string)

Argument

reobjvarRequired. The variable name of the associated Object instantance.ExecuteRequired Method Keyword. To specify the Execute Method of an Object.stringRequired. To specify the text string upon which the regular expression is executed..Required. The dot notation used to access the Property of an object.(…)Required. The brackets to enclose the parameters.

Remarks

  • The actual pattern for the regular expression search is set using the Pattern property of the RegExp object.
  • The Execute method returns a Matches Collection that contains a Match Object for each match found in string. Execute returns an empty Matches Collection if no match is found.

Requirement

5

Applied to

RegExp Object

Replace Method

last updated 12/11/2017

is to replaces the given string1 found in a regular expression search with the specified string2.

Syntax

reobjvar.Replace(string1, string2)

Argument

reobjvarRequired. The variable name of the associated Object instantance.ReplaceRequired Method Keyword. To specify the Replace Method of an Object.string1Required. To specify the text string in which the text replacement is to occur.String2Required. to specify replacement text string.(…)Required. The brackets to enclose the parameters.,Required. the delimiter to separate the parameters.

Remarks

  • The actual pattern for the text being replaced is set using the Pattern property of the RegExp object.
  • The Replace method returns a copy of string1 with the text of RegExp.Pattern replaced with string2.
  • If no match is found, a copy of string1 is returned unchanged.
  • In addition, the Replace method can replace subexpressions in the pattern by using subexpressions of regular expression.

Requirement

5

Applied to

RegExp Object

Test Method

last updated 12/11/2017

is to executes a regular expression search against a given string, and to return a Boolean value indicating if a pattern match was found.

Syntax

reobjvar.Test(string)

Argument

reobjvarRequired. The variable name of the associated Object instantance.TestRequired Method Keyword. To specify the Test Method of an Object.stringRequired. To specify the text string upon which the regular expression is executed..Required. The dot notation used to access the Property of an object.(…)Required. The brackets to enclose the parameters.

Remarks

  • The actual pattern for the regular expression search is set using the Pattern property of the RegExp object. The RegExp.Global property has no effect on the Test method.
  • The Test method returns True if a pattern match is found; False if no match is found.

Requirement

5

Applied to

RegExp Object

Sideway BICK Blog

17/05


Copyright © 2000-2020 Sideway . All rights reserved Disclaimerslast modified on 26 January 2013