Caveat 1: This puts me at approximately Level 3, assuming I started at Level 1 ~wry grin~ so there's probably plenty of room for improvement with these and I'd love to hear your suggestions.
Caveat 2: I'm reproducing this from memory at 10:30 after not getting a whole lot of sleep yesterday night. It's a good exercise in seeing whether I can still catch all the little gotchas that I thought of while writing it earlier, but I may not be entirely successful.
It was a multi-file (facilitated by Eclipse) search as follows (preliminary searches to determine whether I need to make it really complicated): <[^<>]*\s[sS][tT][yY][lL][eE][^<>]*\s[aA][lL][iI][gG][nN]\s*=[^<>]*> <[^<>]*\s[aA][lL][iI][gG][nN]\s*=[^<>]*\s[sS][tT][yY][lL][eE][^<>]*>
These two check for html tags with both style and align attributes (couldn't figure out a way to check for a style attribute before OR after the align attribute in the same regex) [side note: do you prefer 'regex' or 'regexp' for the abbreviation?]
These both came back with no matches, leading me to conclude that there were no tags containing both a style attribute and an align attribute, making the next part much simpler...
Actual Search: (<[^<>]*)(\s[aA][lL][iI][gG][nN]\s*=\s*(\\?['"]?)[cC][eE][nN][tT][eE][rR]\3([^<>]*>)
Replace: $1 style=$3text-align:center;$3 $4
Thereby replacing all no-longer-standards-adherent align attributes with a standards-compliant style attribute that would preserve any escaping of quotes and still be valid (though slightly less standards-compliant) even if there were no quotes. (Valid in the sense that it shouldn't actually cause anything to break if there aren't any quotes in the $3 regex match)
~accepts badge solemnly, replaces L1 badge with it~
~grin~ Thank you ^_^
Also, I checked against the actual thing that I used, and the only difference was that in the actual one I had also provided for the possibility of there being zero or more whitespace characters inside the quotes, so " ceNtER " would have matched.
no subject
Date: 2008-04-04 01:50 am (UTC)Congrats! What earned you the levels?
*curious look*
Mmm, I do so love 'em. Always interested to see what people are doing.
no subject
Date: 2008-04-04 02:42 am (UTC)Caveat 2: I'm reproducing this from memory at 10:30 after not getting a whole lot of sleep yesterday night. It's a good exercise in seeing whether I can still catch all the little gotchas that I thought of while writing it earlier, but I may not be entirely successful.
It was a multi-file (facilitated by Eclipse) search as follows
(preliminary searches to determine whether I need to make it really complicated):
<[^<>]*\s[sS][tT][yY][lL][eE][^<>]*\s[aA][lL][iI][gG][nN]\s*=[^<>]*>
<[^<>]*\s[aA][lL][iI][gG][nN]\s*=[^<>]*\s[sS][tT][yY][lL][eE][^<>]*>
These two check for html tags with both style and align attributes (couldn't figure out a way to check for a style attribute before OR after the align attribute in the same regex) [side note: do you prefer 'regex' or 'regexp' for the abbreviation?]
These both came back with no matches, leading me to conclude that there were no tags containing both a style attribute and an align attribute, making the next part much simpler...
Actual Search:
(<[^<>]*)(\s[aA][lL][iI][gG][nN]\s*=\s*(\\?['"]?)[cC][eE][nN][tT][eE][rR]\3([^<>]*>)
Replace:
$1 style=$3text-align:center;$3 $4
Thereby replacing all no-longer-standards-adherent align attributes with a standards-compliant style attribute that would preserve any escaping of quotes and still be valid (though slightly less standards-compliant) even if there were no quotes. (Valid in the sense that it shouldn't actually cause anything to break if there aren't any quotes in the $3 regex match)
no subject
Date: 2008-04-04 02:47 am (UTC)*hands you a L3 badge*
no subject
Date: 2008-04-04 02:45 pm (UTC)~grin~ Thank you ^_^
Also, I checked against the actual thing that I used, and the only difference was that in the actual one I had also provided for the possibility of there being zero or more whitespace characters inside the quotes, so " ceNtER " would have matched.