Home › Forums › Feature Requests › Regex field ?
Is there a field with a regex validation ?
Example, if I want an URL field, I just have to add this regex in the “Regular Expression” field :
_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,})))(?::\d{2,5})?(?:/[^\s]*)?$_iuS
This can be provided with numerous regex, or we can share our regex with each other!
Thank you

Hi @will83
Thank you for the question.
This feature is not available currently for the ACF plugin but you can be able to get this functionality from this plugin: https://wordpress.org/plugins/validated-field-for-acf/
I have also sent this information to the developer so that this feature can soon see its way into the plugin.
Hi! MrPresident, check this out…
My proprietary ACF plugin, adding a new field that can be validated with any Regex pattern
Make sure if the plugin is active and if you use it and you like it please leave a comment and your opinion
Enjoy <3
The topic ‘Regex field ?’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.