Jump to content

[SOLVED] template engine regex tweak


drifter

Recommended Posts

OK this is from the template engine.

[code]
// matches bracket portion of vars
// [0]
// [foo]
// [$bar]
// [#bar#]
$this->_var_bracket_regexp = '\[[\$|\#]?\w+\#?\]';

// matches $ vars (not objects):
// $foo
// $foo[0]
// $foo[$bar]
// $foo[5][blah]
$this->_dvar_regexp = '\$[a-zA-Z0-9_]{1,}(?:' . $this->_var_bracket_regexp . ')*(?:\.\$?\w+(?:' . $this->_var_bracket_regexp . ')*)*';
[/code]

So I want to tweak the last one so that it will accept $foo + $bar or $foo - $bar[0] or $foo + 4

basically I want to take the same expression and be able to add 0 or more of these expressions to the end  (or integers) with +- operations

I know this should be easy since most of it is there.

Thanks Scott
Link to comment
https://forums.phpfreaks.com/topic/31537-solved-template-engine-regex-tweak/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.