I have two strings PG((0,0), (0,1), (1,1), (1,0)) and P(1,1)
I need to write code that would identify those string with the help of a regular expression.
So far I have this:
if(re.search("^[P\(]",line) is not None):
print "P found"
This identifies both strings, but should only identify P(1,1)
if(re.search("^[PG\(\(]",line) is not None):
print "PG found"
This also identifies both strings, but should only identify PG((0,0), (0,1), (1,1), (1,0))
What am I doing wrong here?
[])? It seems to me that it should work if you remove those.