Validating CustomPress custom fields

There's a custom field created with CustomPress with field type "Text Box". It has to be validated against http:// / https:// prefixes so it must be sure that there's an URL put in that field and it does contain one of these two prefixes.

This two regular expressions had been tried in CustomPress "Regular Expression Validation" field for that custom field and none of them works:

^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$

alternative:

^(http(s?)\:\/\/|~/|/)?([a-zA-Z]{1}([\w\-]+\.)+([\w]{2,5}))(:[\d]{1,5})?/?(\w+\.[\w]{3,4})?((\?\w+=\w+)?(&\w+=\w+)*)?^

How to validate that field using regular expression in CustomPress field setting?

  • Adam Czajczyk
    • Support Gorilla

    Hello John,

    I hope you're well today!

    We checked that and it seems that there's a bug in the plugin. It's already been reported to our developers and they'll work on a fix. Please make sure that you keep the plugin up to date and also keep an eye on this thread, in case we had any additional information or questions for you before the fix is released.

    Best regards,
    Adam

  • Predrag Dubajic
    • Support

    Hey John,

    Apologies for the delay here, we have a fix ready that will be included in next release but there are couple of more things that are being looked into before the release.

    I will attach patched files for this issue before so you can apply them to your current installed version to fix this.
    These are the files and their locations:

    wp-content/plugins/custompress/core/content-types.php
    wp-content/plugins/custompress/ui-admin/add-custom-field.php
    wp-content/plugins/custompress/ui-admin/edit-custom-field.php
    wp-content/plugins/custompress/ui-admin/js/jquery.validate.js

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.