Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Wild card for digits only

If you have a question or need help, this is the place to be.
Post Reply
smbs
Posts: 5
Joined: Fri Apr 28, 2017 2:28 pm

Wild card for digits only

Post by smbs »

I am using the PHX01RN PLUGIN
PHXO1RN.* matches any key pressed on my remote. I want to limit the wildcard input to match digits only.Regex would be something like \d*
Maybe a python script -but my Python scripting is very limited.
Many thanx
User avatar
yokel22
Experienced User
Posts: 265
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Wild card for digits only

Post by yokel22 »

Give this a try:

Code: Select all

import re

# RegEx matching the event suffix.
regEx = re.match('\d', eg.event.suffix)
if regEx != None:
    # match made, suffix is digit.
    # exit script, continue subsequent actions in the macro.
    eg.Exit()
else:
    # no match made, Stop macro immediately.
    eg.StopMacro()
smbs
Posts: 5
Joined: Fri Apr 28, 2017 2:28 pm

Re: Wild card for digits only

Post by smbs »

Great works like a charm -many thanx
Post Reply