Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with regular expression

Status
Not open for further replies.

cluM09

Technical User
May 15, 2004
127
US
Hello,

I need to get the string of the line that is enclosed within the square brackets.

I try to use the following regular expression, but I keep getting a syntax error.

str = "[This is the data]"

Set objRE = New RegExp
With objRE
.IgnoreCase = True
.Global = True
.Pattern = = "\[(.*)\]"
End With

Set colItems = objRE.Execute(str)
For Each objItem in colItems
Wscript.Echo objItem.SubMatches(0)
Next

What would be the pattern to extract the data within
the square brackets?

Thanks


 
>[tt] .Pattern [highlight]= =[/highlight] "\[(.*)\]"[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top