Where
. + represents a match of any character 1 to an infinite number of times
\s represents matching spaces, tabs, page breaks, and so on, equivalent to [\f\n\r\t\v]
import Re target_pattern = [(lambda? x (P E. x)) "," (Lambda? x (and (P E. x) (P. x)) "," (Lambda? x Exist ?y ( and ( P E ?y ) ( P ?y ?x ) ) )",
"( lambda ?x Exist ?y ( and ( P E ?y ) ( P ?y E ) ( P ?y ?x ) ) )",
"( lambda ?x Ex Ist y (and (P. y) (P. y x)) ",] patterns = [] pa = re.compile (' lambda.+x\s.+mso.+x ') Patterns.app End (PA) pa = re.compile (' lambda.+x\s.+and.+mso.+x.+mso.+x ') patterns.append (PA) pa = re.compile (' lambda.+x\sexist.+
And.+mso.+y.+mso.+y.+x ') patterns.append (PA) pa = re.compile (' lambda.+x\sexist.+and.+mso.+y.+mso.+y.+mso.+y.+x ')
Patterns.append (PA) pa = re.compile (' lambda.+x\sexist.+and.+mso.+y.+mso.+y.+x.+mso.+y.+x ') patterns.append (PA) Print (Patterns[0].match ("Lambda x (mso:meteorology.tropical_cyclone.total_fatalities Cyclone_bejisa)"). Group () Patterns[1].match (r-mso:film.film.cinematographer Jost_vacano x) print ("Lambda? X") (R-mso:film.film.story Ron Ald_shusett x)). Group ()) print (Patterns[2].matCH ("lambda" x Exist y (mso:film.character.film radagast y) (mso:film.film.location? y)) (). Group ()) print ( Patterns[3].match ("lambda" x Exist y (mso:projects.project.project_participation snrc_:_robust_and_adaptive_ Protocol_design_for_multimedia_wireless_networks_research y) (mso:projects.project_participation.project_ Participant y Stanford_networking_research_center) (mso:projects.project_participation.from_date y. x))). Group ( ) Print (Patterns[4].match ("Lambda? x Exist? y") (Mso:organization.organization.leadership derby_moor_community_ Sports_college y) (Mso:organization.leadership.role y x) (Mso:organization.leadership.person y. x)). Group ())