I'm working on a language file for GeSHi and would like to highlight the (unknown) word following a keyword and some whitespace. I have tried something like
$language_data = array (
...
'KEYWORDS' => array(
1 => array(
'keyword1', 'keyword2'
)
),
...
'REGEXPS' => array(
0 => array(
GESHI_SEARCH => '(((keyword1|keyword2)\s+)([a-zA-Z_][a-zA-Z0-9_]*))',
GESHI_REPLACE => '\\4',
GESHI_MODIFIERS => '',
GESHI_BEFORE => '\\2',
GESHI_AFTER => ''
)
),
...
)
But the regular expression never matches. I assume that the keyword is already consumed by the parser when the regular expression is tested.
A lookbehind does not work in GESHI_SEARCH
because the length of the real keywords and the separating whitespace is not fixed (see What's the technical reason for "lookbehind assertion MUST be fixed length" in regex?).
How can I highlight a word after a keyword in GeSHi?