[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread BlackDex
Eli [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Eli wrote: Try: preg_replace('/(?=\)([^]*)(\w+)=(?!\'|\)([^\s]+)(?=\s|\)([^]*)(?=\)/U','\1\2=\3\4',$html); Hmm.. that could be a start.. and don't ask me how it works... :P Well.. problem with that, is that if you got more

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread BlackDex
Eli [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Eli wrote: Try: preg_replace('/(?=\)([^]*)(\w+)=(?!\'|\)([^\s]+)(?=\s|\)([^]*)(?=\)/U','\1\2=\3\4',$html); Hmm.. that could be a start.. and don't ask me how it works... :P Well.. problem with that, is that if you got more

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread Eli
Yup.. that was a good point.. ;) Take a look at this example: ?php function tag_rep($tag) { return reg_replace('/(?!\)(\S+)\s*=\s*(?![\'])([^\s\']+)(?![\'])/','\1=\2',$tag); } $html=p class=MsoNormal id=parfont size=3 face=\Comic Sans MS\span lang=NL

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread Eli
Sorry for the spam.. here it is: ?php function tag_rep($tag) { return preg_replace('/(?!\)(\S+)\s*=\s*(?![\'])([^\s\']+)(?![\'])/','\1=\2',$tag); } $html=p class=MsoNormal id=parfont size=3 face=\Comic Sans MS\span lang=NL style='font-size:12.0pt;font-family:\Comic Sans MS\'a

Re: [PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread Jochem Maas
Eli wrote: BlackDex wrote: Hello ppl, I have a question about regex and html parsing. I have the following code: --- p class=MsoNormalfont size=3 face=Comic Sans MSspan lang=NL style='font-size:12.0pt;font-family:Comic Sans MS'nbsp;/span/font/p you realise that that HTML ammounts the to the

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread BlackDex
Thx... it works almost :P I Changed the code a bit so you can see the results quicker :). It doesn't change every attribute/value. I think this has to do something with the opening and closing of a tag . My code: --- ?php function tag_rep($tag) { return

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread BlackDex
Owkay.. i fixed it :). Here is the final code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread BlackDex
Owkay i fixed it :D. The regexp needed a /s (Pattern Modifier) also so that the .(DOT) also does newlines :). Now it is fixed... Thank you very much Eli :) /me is happy. THE CODE: --- ?php function tag_rep($tag) { return

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-09 Thread Eli
BlackDex wrote: Hello ppl, I have a question about regex and html parsing. I have the following code: --- p class=MsoNormalfont size=3 face=Comic Sans MSspan lang=NL style='font-size:12.0pt;font-family:Comic Sans MS'nbsp;/span/font/p --- It laks some quotemarks. I want to change it to: --- p

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-09 Thread Eli
Eli wrote: Try: preg_replace('/(?=\)([^]*)(\w+)=(?!\'|\)([^\s]+)(?=\s|\)([^]*)(?=\)/U','\1\2=\3\4',$html); Hmm.. that could be a start.. and don't ask me how it works... :P Well.. problem with that, is that if you got more than 1 un-escaped attribute in a tag, the regex will fix only the first