I have a regular expression to strip out redundant crap that Office generates in its html files, but everything matches tags with quotes in it..... for instance width="20", but how do I match if there's no quotes..... width=20 ?
WIDTH="["]*["]
Untested, as I am a .Net nerd and I am not so sure of the PHP regex, but how about:
width=['"]?['"]*['"]?
Match a string - starting with the word width, - followed by an equals sign, - then zero or one single or double apostrophes, - then any character that is not a single or double apostrophe, - finally zero or one single or double apostrophes.
As (in theory) there will only ever be a number as the width, you could also try:
width=["']?[\d]*['"]?
Originally posted by: scudsucker As (in theory) there will only ever be a number as the width, you could also try:
width=["']?[\d]*['"]?
You probably meant \d+ (1 or more numbers) but anyway you also have to account for "20%", "20px", "20 " etc. 
~
(?i)width
would match both "WIDTH" and "width" and "Width"