KathyBlue
KathyBlue

Reputation: 366

VBS Regex pattern word space word

I would like to keep "Document Brasil" in a list from the following pattern in VBS:

<Document FormTypeName="Document Brasil">

I tried this, but it doesn't seem to work. :

objReg.Pattern = "Document FormTypeName=""(.+\.\s.+\.)"""

Matches return 0. Which is the correct regular expression to catch only "Document Brasil"?
Word space Word ?

Upvotes: 0

Views: 119

Answers (1)

Ekkehard.Horner
Ekkehard.Horner

Reputation: 38745

Given the rules for attributes, I'd search for a sequence of non-" between "s. As in:

>> Set r = New RegExp
>> r.Pattern = "<Document FormTypeName=""([^""]*)"">"
>> WScript.Echo ">" & r.Execute("<Document FormTypeName=""Document Brasil"">")(0).Submatches(0) & "<"
>>
>Document Brasil<

Upvotes: 2

Related Questions