style property regular expression
-
Hi to all I would like to search a html document file for all the style properties and loop through them for example if i have the code :
I want the regular expression to pick up the following text style="color:#fff" style="text-align:center" I want to get the amount if hits it found and then I should be able to loop through it. Sorry this is probably a noob question but havent used regex for 2 years C# code please Thanx Le Roux Viljoen Web Developer PCW New Media South African Branch www.pcwnewmedia.com
-
Hi to all I would like to search a html document file for all the style properties and loop through them for example if i have the code :
I want the regular expression to pick up the following text style="color:#fff" style="text-align:center" I want to get the amount if hits it found and then I should be able to loop through it. Sorry this is probably a noob question but havent used regex for 2 years C# code please Thanx Le Roux Viljoen Web Developer PCW New Media South African Branch www.pcwnewmedia.com
-
style[\s]*=[\s]*"([a-z0-9\s;:]+(?!=[>"])) i presume you can write c# code
Code? Yeah i love it fried together with a glass of wine.
Thanx Yes i will be able to take it from here
Le Roux Viljoen Web Developer PCW New Media South African Branch www.pcwnewmedia.com
-
Thanx Yes i will be able to take it from here
Le Roux Viljoen Web Developer PCW New Media South African Branch www.pcwnewmedia.com
I'd like to add that you should take a look at the Expresso tool found on this site for working with regular expressions. In case you have more regular expressions to work with, you may find it very useful :-D
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
-
I'd like to add that you should take a look at the Expresso tool found on this site for working with regular expressions. In case you have more regular expressions to work with, you may find it very useful :-D
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
also I found that this code style[\s]*=[\s]*"([^"]+(?!=[>"]))["] works a bit better as the previous code cut off the style code at "-" characters
Le Roux Viljoen Web Developer PCW New Media South African Branch www.pcwnewmedia.com