

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Shorten the value
I have a field where I get the value using this code:
LoginUser = Browser("eVoucher 7_4").Page("eVoucher 7").WebElement("Welcome, Patrick Jones").GetROProperty("innertext")
Value = Welcome, Patrick Jones (Court Staff) Logout
I would like to shorten the value to equal " Court Staff"
only thing is the value between the "( )" could be different , Judge, Attorney, etc
Can anyone help?


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
You can do this using the Split command.
https://devguru.com/content/technologies/vbscript/functions-split.html
Mark Smith.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
You may also use regular expression.
Set objRE = New RegExp
With objRE
.Pattern = "Welcome.*\((.*)\)+"
.IgnoreCase = True
.Global = False
End With
x = "Welcome, Patrick Jones (Court Staff) Logout"
Set objMatch = objRE.Execute( x )
' We should get only 1 match since the Global property is FALSE
txt = "empty"
If objMatch.Count = 1 Then
txt = objMatch.Item(0).submatches(0)
print txt
msgbox txt
End If