Skip to content

Regexes in expression #2

Description

I would like to have a feature for Regexes in expressions.

Like this:

<?IF expr="variable =~ /^blah(blubb)?/" ?>
<?/IF?>

or with like as equvalent for =~

<?IF expr="variable like /^blah(blubb)?/" ?>
<?/IF?>

The same with negated Regex match:

<?IF expr="variable unlike /^blah(blubb)?/" ?>
<?/IF?>

<?IF expr="variable !~ /^blah(blubb)?/" ?>
<?/IF?>

An other related nice feature would be getting the matched Regex subpatterns like this:

<?IF expr="variable =~ /^blah(blubb)?/" ?>
Match of pattern 1 is: <?= variable.1 ?>
<?/IF?>

or that:

<?IF expr="variable =~ /^blah(blubb)?/" ?>
Match of pattern 1 is: <?= variable.~1~ ?>
<?/IF?>

Or anything other syntax for the subpattern.
Depends on your idea of implementation.

//EDIT: My wish was inspired syntax of Blosxom's interpolate_fancy

Thanks a lot for the module! Mostly used in webdevelopment by me.

The module should get a golden Camel Award. ;)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions