Hello,
The program given below returns the lines:
a
ab
Is there a way to use python regular expressions such that the program
would return the following lines?
ab
ab
############### ############### ############### ############### ############
import re
rx1 = re.compile("(a| ab)")
rx2 = re.compile("(ab |a)")
out1 = rx1.search("ab" )
out2 = rx2.search("ab" )
print out1.group(1)
print out2.group(1)
############### ############### ############### ############### ############
Jörg
The program given below returns the lines:
a
ab
Is there a way to use python regular expressions such that the program
would return the following lines?
ab
ab
############### ############### ############### ############### ############
import re
rx1 = re.compile("(a| ab)")
rx2 = re.compile("(ab |a)")
out1 = rx1.search("ab" )
out2 = rx2.search("ab" )
print out1.group(1)
print out2.group(1)
############### ############### ############### ############### ############
Jörg
Comment