Feature #23633

regex in TCA eval function

Added by Robert Heel about 9 years ago. Updated over 1 year ago.

Should have
Backend API
Target version:
Start date:
Due date:
% Done:


PHP Version:
Sprint Focus:


Would be nice to use regex in eval to check values of input fields.

With the attached patch you can use
'eval' => 'trim,lower,/[a-z0-9 _-]*/'
in your TCA configuration.


(issue imported from #M15836)

eval_regex.diff View (967 Bytes) Administrator Admin, 2010-09-28 19:04


#1 Updated by Steffen Kamper about 9 years ago

indeed no bad idea, but i wouldn't do it this way. it depends on delimiter = / and doesn't allow modifiers.

This syntax i would prefer: regex(/any expression/any modifier)

#2 Updated by Robert Heel about 9 years ago

Thanks! The patch already allows a modifier (search for / at last and next to last position). Existing expressions also not function-style - so I have chosen this syntax.

#3 Updated by Alexander Opitz over 4 years ago

  • Description updated (diff)
  • Category set to Backend API
  • Target version deleted (0)

#4 Updated by Sybille Peters over 1 year ago

Thank you for your report.

Even though it has been some time, would you consider checking if your patch idea is still up to date and upload it to our Gerrit review server?

Someone could do this for you, but I am thinking you might like the opportunity to contribute to TYPO3 yourself.

You can find a description of the TYPO3 contribution workflow here: https://docs.typo3.org/typo3cms/ContributionWorkflowGuide/

Hint: If you get stuck anywhere, ask on Slack in the #typo3-cms-coredev channel. You can register in the TYPO3 slack workspace here: https://forger.typo3.com/slack

Thank you in advance!

#5 Updated by Julian Hofmann over 1 year ago

It is still a nice feature (and we need it actually).

This syntax i would prefer: regex(/any expression/any modifier)

Thinking about a better syntax, my idea was to have a look at extbase validators syntax. In my opinion, it would be nice to have consistent syntax for same properties in a project/software.
Extbase uses e.g.: regularExpression(regularExpression="/^[0-9]{5}$/")

@robert: Currently the patch would only allow modifiers which consists of one single character

Also available in: Atom PDF