How does regex work?

Enonic version: 6.3
OS: Windows 7

Hi

I am trying to use a regex to get just numbers in a content type (this regex ^[0-9]+$ ) I tested this regex in (https://regex101.com/) for check my regex and it works. Nonetheless, when I am creating this content on admin site it doen’st work

How did I do wrong?

Thank you for your help.

Hi

I have not tested your regex, but it should work, how do you add it to your content type? It should be like this (note that my regex is for another purpose):

<input type="TextLine" name="versionNumber">
                        <label>Version number</label>
                        <occurrences minimum="1" maximum="1"/>
                        <config>
                            <regexp>^[0-9]+\.[0-9]+\.[0-9]+$</regexp>
                        </config>
                    </input>
1 Like

Hi tlo

I forget put my regex tag inside in a config tag when I did it it works

Thank you for your help

2 Likes