[Tutor] Python Regex References
I am trying to convert the SED code below to Python3.3. How do I reference the value of the first and second wildcards so that I can put the variable values in the "replace" portion of the code? SED (this works): export DATA=$(echo "$DATA" | sed -r -e "s|^ $|\1(>=>)\2|gI") Python3.3 (attempted): DATA = re.sub('^$', '\1(>=>)\2', DATA, flags=re.I) Thank you, devyncjohn...@gmail.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Python Regex References
I am trying to convert the SED code below to Python3.3. How do I reference the value of the first and second wildcards so that I can put the variable values in the "replace" portion of the code? SED (this works): export DATA=$(echo "$DATA" | sed -r -e "s|^ $|\1(>=>)\2|gI") Python3.3 (attempted): DATA = re.sub('^$', '\1(>=>)\2', DATA, flags=re.I) Thank you. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor