Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-10-2017, 08:34 AM
Hang Hang is offline
Registered User
 
Join Date: Jul 2016
Posts: 20
use ReadString to match a regular expression

Hi,

I like a script to match a regular expression to make it more universal but when I try it out, it doesn't work. I get an error saying ReadString need to match with a string.

I know the regex I have there works for what I need to match because I have tested.

Code:
# $language = "python"
# $interface = "1.0"
import re

def Main():

	p = re.compile("([\*[A|B].*\#])")
	szPrompt = p

	objTab = crt.GetScriptTab()
	objTab.Screen.Synchronous = True
	objTab.Screen.IgnoreEscape = True

	szCommand = "show card"
	objTab.Screen.Send(szCommand + "\n")

	szResult = objTab.Screen.ReadString(szPrompt)

	crt.Dialog.MessageBox(szResult)

Main()
Thanks,

Last edited by Hang; 11-10-2017 at 08:37 AM.
Reply With Quote
 

Tags
regex , regular expression


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 03:42 PM.