I have an event where the value is passed after the final decimal. How can I grab that with a regexp and pass it to a action?
Broadcast.volumelevel.45
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.
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.
regexp on eg.event.string
Re: regexp on eg.event.string
Well.. the simplest way is to use plain string split to split it into an array, no need to use regexp for something simple like this
If you wanted you could do it with regexp with something like..
regexp is really useful though, not only in python but everywhere in programming, so I really recommend learning it to everybody. http://www.regular-expressions.info/ is a good site for reading up on it.
-jinxdone
Code: Select all
print('Broadcast.volumelevel.45'.split('.'))
# prints an array ['Broadcast', 'volumelevel', '45']Code: Select all
import re
r = re.search('[^\.]+?$', 'Broadcast.volumelevel.45')
print(r.group(0))
# prints the string '45'.-jinxdone