As usual, the regexp module drive me nutts. I simply want to do the equivalent to: # from a bash shell xx="<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>". echo $xx | sed 's/\(.*xml\ version=.*encoding="\)\([a-zA-Z0-9_-]*\).*/\2/' ISO-8859-1 So how do I do this with the regexp module ? Cheers, Tobbe