RoboTask User's Guide
Keyword Index
Home page



IconQuick Start Guide
IconSeveral practical recommendations
IconMenus
IconActions
IconTriggering Events
IconAppendix
IconOther software

© 2004-2017 Neowise.com

RegExp COM object

Top  Previous  Next

 

RegExp COM object is designed for using in Basic script.

Object name: RegExpCOM.RegexpClass

Object GUID: ['{0762F9AA-BD80-4BFC-B469-854866F114CC}']

 

Example of using

Below is an example of using RegExp COM object in Basic script

 

Sub Main

 

Dim obj As Object

Dim i As Long

Dim cnt As Long

Dim res As Boolean

Dim s As String

 

Set obj = CreateObject( "RegExpCOM.RegexpClass" )

 

obj.Subject = RoboTaskApp.ExpandText("{txt}")

obj.RegExp = RoboTaskApp.ExpandText("{regex}")

 

res = obj.Match

While res

  cnt = obj.SubExpressionCount

  s = ""

  For i = 0 To cnt

    s = s + obj.SubExpression( i ) + Chr(10)

  Next i

  MsgBox( s )

  res = obj.MatchAgain

Wend

 

End Sub

 

Also you can make permanent link to RegExpCOM Library in the script. In this case you should declare the object so:

Dim obj As RegExpClass

And create the object by using New directive

Set obj = New RegExpClass

 

Members of object

 

Anchored

Read-Write property, type – Boolean

Get or set anchored mode of object.

 

Caseless

Read-Write property, type – Boolean

Get or set case insensitive mode of object.

 

Extended

Read-Write property, type – Boolean

Get or set extended mode of object.

 

Match

Read-only property, type – Boolean

Find first match. Returns TRUE if expression was found.

 

MatchAgain

Read-only property, type – Boolean

Find next match. Returns TRUE if expression was found.

 

Multiline

Read-Write property, type – Boolean

Get or set multiline mode of object.

 

NoAutoCapture

Read-Write property, type – Boolean

Get or set NoAutoCapture mode

 

RegExp

Read-Write property, type – String

Get or set regular expression.

 

Replace

Read-only property, type - String

It replaced found expression by "replacement" and returns new expression.

This property can be used only after successful Match or MatchAgain.

 

ReplaceAll

Read-only property, type – Long

Replace all matches. Returns the number of replacements.

 

Replacement

Read-Write property, type – String

The replacement string. Used in Replace and ReplaceAll.

 

SingleLine

Read-Write property, type – Boolean

Get or set single line mode of object.

 

SubExpression(ByVal idx as Long)

Read-only property, type- String

Returns sub-expression by index.

This property can be used only after successful Match or MatchAgain.

 

SubExpressionCount

Read-only property, type- Long

Returns the number of sub-expressions.

This property can be used only after successful Match or MatchAgain.

 

SubExpressionLength(ByVal idx as Long)

Read-only property, type – Long

Returns the length of sub-expression by index.

This property can be used only after successful Match or MatchAgain.

 

SubExpressionOffset(ByVal idx as Long)

Read-only property, type – Long

Returns the offset (position) of sub-expression by index.

This property can be used only after successful Match or MatchAgain.

 

Subject

Read-Write property, type – String

Get or set the text to process.

 

Ungreedy

Read-Write property, type – Boolean

Get or set un-greedy mode of object.

 

 

note Related Topics

RegExp Loop

RegExp Replace

RegExp Match