Page 2 of 13
Posted: Fri May 25, 2007 8:53 pm
by ziggy3000
how would i make the pattern so the code to be highlighted can be found in between the lines?
Posted: Fri May 25, 2007 8:57 pm
by Kieran Huggins
Jcart wrote:Code: Select all
SELECT `answer` FROM `jcart` LIMIT 1
You thought right

Posted: Fri May 25, 2007 8:58 pm
by ziggy3000
no, i meant in preg_replace, what should i put as the pattern so my highlighter scans all words in the inputed code.
in geshi, i tried to alter the code, but it's so confusing, because it uses different classes, and functions so much
trying to follow what the code is saying makes my head go

Posted: Fri May 25, 2007 9:02 pm
by John Cartwright
pass an array of patterns and an array of replacements
Posted: Fri May 25, 2007 9:02 pm
by ziggy3000
nevermind, i was reading
pattern syntax and i got it

Posted: Fri May 25, 2007 9:03 pm
by ziggy3000
i didn't need to do that, in my original code i posted, i replaced ^ with . and it worked!
Posted: Fri May 25, 2007 9:05 pm
by John Cartwright
Not exactly sure what you are trying to accomplish
Posting your finals results allows the users to benefit as well.
Posted: Fri May 25, 2007 9:08 pm
by ziggy3000
this was my original output
SELECT
`hj`
FROM
hi DESC
i was trying to highlight FROM and DESC, but when i had ^ in my pattern, it only highlighted the first word. i wanted it to highlight FROM and DESC
so now it looks like
Posted: Sat May 26, 2007 10:30 am
by ziggy3000
what should my pattern be if i want to highlight = to green?
this is what i am putting as my pattern, replacement, and my output
Pattern : "/=/"
replacement: "<div style='color:green'> \\1 </div>"
output:
'color:green'>
Posted: Sat May 26, 2007 11:05 am
by Chris Corbyn
ziggy3000 wrote:what should my pattern be if i want to highlight = to green?
this is what i am putting as my pattern, replacement, and my output
Pattern : "/=/"
replacement: "<div style='color:green'> \\1 </div>"
output:
'color:green'>
You don't have to edit more than one file to get GeSHi to highlight differently. The syntax configuration is stored in one file for each language. Just edit the geshi/sql.php file. It's a big array with all the definitions and colors in it. You can change it to whatever you need. Considering GeSHi highlights declarative languages like HTML and YAML just as well as it highlights things like C, PHP and Java I would think you'll have better success with it. All you have to do is change the definitions.
Posted: Sat May 26, 2007 4:31 pm
by ziggy3000
yes i know, i already tried that. can you guys just help me with what i need, and not talk about geshi
the geshi only has arrays, not the code they used to highlight the arrays.
Posted: Sat May 26, 2007 5:02 pm
by feyd
Geshi has more that just "arrays." The arrays only define various keywords, highlighting application rules and so forth.
Posted: Sat May 26, 2007 5:32 pm
by Chris Corbyn
ziggy3000 wrote:yes i know, i already tried that. can you guys just help me with what i need, and not talk about geshi
the geshi only has arrays, not the code they used to highlight the arrays.
There's no \\1 in your pattern because there's no parentheses in it. Put ( and ) around the bit you want to access as \\1.
Posted: Sat May 26, 2007 9:04 pm
by ziggy3000
i am using
/(=)/
as my pattern, but it still doesn't work.
Posted: Sat May 26, 2007 9:14 pm
by John Cartwright
Yet again, it works for me. Make our lives easier in the future, and instead of saying "it doesn't work" post what you have tried.