in reply to editing a file with regular expressions
ors/xdbns='jabber:iq:auth'>.*?</xdbns='jabber:iq:auth'>$usernewpwd</g;
Note that I changed .* to .*?; this will cause it to prefer to stop matching at the first < instead of going on to a later < on the line.s/(xdbns='jabber:iq:auth'>).*?(<)/$1$usernewpwd$2/g;
Have you considered quoting issues? E.g. if a password actually contains a character like "<", what will whatever usually builds the file put there? And can you do it the same way to $usernewpwd, and adjust the regex to handle it? It might be better to look to one of the fine XML modules available on CPAN, than do it by hand.
Update: And as Boris says, you need to make sure to actually write out the changed lines to a new file.
|
|---|