Regular expression question

Patrick Gaherty pgaherty at chambersharrap.co.uk
Wed May 8 05:02:31 EDT 2002


Im performing the following search and replace in Python. However, I 
would like to return the first group as lowercase using .lower() in the 
replacement string, What's the best way of achieving this?

result = re.sub(r'<TABLE NAME="(.*?)">(.*?)</TABLE>', r'<a 
href="javascript:openWin(\'images/\1.htm\');">\2</a>', result)

Thanks

Patrick Gaherty




More information about the Python-list mailing list