Search found 205 matches

by ziggy3000
Thu Jun 14, 2007 5:51 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

ok, i am using this for multiline comments

Code: Select all

$sql = preg_replace("'(/\*.*)(<([\w]+)>)(.*)(</\\3*>)(.*\*/)'", "<span class='comment'>$1$4$6</span>", $sql);
it still doesn't remove html tags.
by ziggy3000
Wed Jun 13, 2007 6:31 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

it's not that, i have told him a lot of times, but in every post, he says regex coach about 3 times, and tells me to get it every time.
by ziggy3000
Wed Jun 13, 2007 6:17 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

here's something that i have told you a long time ago...

I GOT REGEX COACH A LONG TIME AGO!!!!
THAT JUST TELLS YOU WHAT TO USE AS REGEX, NOT HOW TO USE IT
by ziggy3000
Wed Jun 13, 2007 4:47 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

ok, but i dont get how to implement the regex so that it leaves out the html tags.
by ziggy3000
Wed Jun 13, 2007 4:31 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

i can, but i want to learn what i am doing wrong.
by ziggy3000
Wed Jun 13, 2007 4:16 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

this is what i am trying preg_match_all("#(\/\*[^<>]*)(<([\w]+)[^>]*>)(.*)(<\/\\3*>)([^<>]\*/)#", $sql, $match, PREG_SET_ORDER); foreach($match as $var){ echo $var[1].$var[4].$var[6]."<br />"; } and the result is that it highlights everything between /* and */, but if there is ht...
by ziggy3000
Wed Jun 13, 2007 3:24 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

SOMEONE PLEASE HELP ME!!!!!!!!!!!!!!!!
by ziggy3000
Sun Jun 03, 2007 1:25 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

well, by it wont work, i meant that it wont remove the html tags so the result is the same as before.
by ziggy3000
Sat Jun 02, 2007 9:40 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

well, i am trying $sql = preg_replace("#(\/\*[^<>]*)(<([\w]+)[^>]*>)(.*)(<\/\\3*>)([^<>]\*/)#", "<span class='comment'>\\1\\3\\5</span>", $sql); but's it doesn't work. ediT: i am also trying this but it wont work preg_match_all("#(\/\*[^<>]*)(<([\w]+)[^>]*>)(.*)(<\/\\3*>)([^...
by ziggy3000
Sat Jun 02, 2007 9:35 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

ok, using regex coach, i got the following regex

Code: Select all

(\/\*[^<>]*)(<([\w]+)[^>]*>)(.*)(</[\w]*>)([^<>]\*/)
how would i use it?
$1, $3 and $5 are the things i need to highlight, right?
by ziggy3000
Sat Jun 02, 2007 8:40 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

yea, but i can't get my pattern to work. i am adding one before and after the one on php.net which has the /* and */. can you use your regex coach(i dont know how to use it) and then tell me the pattern i need? edit: this is what i am using, but it doesn't work $sql = preg_replace("#(\/\*[^<>]*...
by ziggy3000
Sat Jun 02, 2007 7:55 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

i found something wonderful :D Example 1674. Find matching HTML tags (greedy) <?php // The \\2 is an example of backreferencing. This tells pcre that // it must match the second set of parentheses in the regular expression // itself, which would be the ([\w]+) in this case. The extra backslash is //...
by ziggy3000
Sat Jun 02, 2007 6:39 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

so far, my pattern would be perfect if it didn't include any HTML :madblow: at least it highlight multi line comments my pattern $sql = preg_replace("#(\/\*[^<>]*)([^<>]\w{0,400})(.*\*/)#i", "<span class='comment'>\\1\\2\\3</span>", $sql); edit: can't i have 2 seperate replaces t...
by ziggy3000
Sat Jun 02, 2007 4:33 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

yea but without it, here is the output /* SELECT * FROM `table` */ and with it /* SELECT * FROM `table` */ and this is what i am trying to parse /* SELECT * FROM `table` */ HTML OUTPUT <span class="comment">/* <br><span class="keyword">SELECT</span> * <span class="keyword&qu...
by ziggy3000
Sat Jun 02, 2007 4:28 pm
Forum: PHP - Code
Topic: MySQL highlighter
Replies: 189
Views: 14521

even if you include $2, it doesn't change anything. actually $2 helps the parsing... because without it, well, $2 is like a newline(\n)