Hi,
I tried the script you posted and it works perfect when strResult is hardcoded.
However I have a problem using the script when strResult isn't hardcoded.
This is the script I'm running now:
Code:
#$language = "VBScript"
#$interface = "1.0"
crt.Screen.Synchronous = True
ClipText = crt.Clipboard.Text
Command_show_port_no = "sh port " & ClipText & " no | i " & ClipText
crt.Screen.Send Command_show_port_no & vbcr
crt.Screen.WaitForString vbcr
strResult = crt.Screen.ReadString(vbcrlf)
Set re = new RegExp
re.IgnoreCase = False
re.Pattern = "(VL_\d+)_"
' |____|
' ||
' Data that matches pattern between
' 1st set of ()s will be known as:
' ...Submatches(0)
If Not re.Test(strResults) Then
crt.Dialog.MessageBox _
"Pattern '" & re.Pattern & "' wasn't found: " & _
vbcrlf & vbcrlf & strResults
crt.Screen.SendSpecial("MENU_SCRIPT_CANCEL")
Else
Set objMatches = re.Execute(strResults)
strDataWeAreAfter = objMatches(0).Submatches(0)
crt.Dialog.MessageBox "Here's what we extracted: " & strDataWeAreAfter
'...
End If
The script only gives me the error message "
Pattern 'VL_\d+)_' wasn't found".
Can you please advise me on this?