import re
def ExampleTrigger (label, ontext, wildcards):
#world.note ("Trigger " + label + " fired.");
#world.note ("Matching line was: " + ontext);
if re.search('You are not on the ground!', ontext):
world.note ("Text matched!");
What I am trying to do I could handle in a normal regular expression trigger using (*.?) in this line.
You are not on the ground!
to make it look like this:
You are not (.*?) the (.*?)!
So it would match:
You are not on the ground!
You are not in the air!
You are not in the trees!
So the question is how do I concactanate the regex string in the script to do the same thing?
I tried:
if re.search('You are not ' + (.*?) + ' the ' + (.*?), ontext):
but it fails
def ExampleTrigger (label, ontext, wildcards):
#world.note ("Trigger " + label + " fired.");
#world.note ("Matching line was: " + ontext);
if re.search('You are not on the ground!', ontext):
world.note ("Text matched!");
What I am trying to do I could handle in a normal regular expression trigger using (*.?) in this line.
You are not on the ground!
to make it look like this:
You are not (.*?) the (.*?)!
So it would match:
You are not on the ground!
You are not in the air!
You are not in the trees!
So the question is how do I concactanate the regex string in the script to do the same thing?
I tried:
if re.search('You are not ' + (.*?) + ' the ' + (.*?), ontext):
but it fails