I need to parse EDIFACT message in python.
To find segment e.g UNB I am trying to use regex
pattern = "UNB(.*?)(?<!\?)(\?\?)*[']"
and test string
message = "UNA+456+6:54+654'UNB+64+654+54?'UNC+54+654+654'"
Segment delimeter is ' (apostrophe) and ? is escape char.
In RegexCoach the match string is UNB+64+654+54?'UNC+54+654+654'
That is right becouse the first apostrophe after UNB is escaped
But in Python 3.5
re.match(pattern,message)
return None :( Do you have idea where is error? Or suggestion for another solution?
Thank
test: