Foxtrek_64 Posted January 11 Posted January 11 (edited) I have a database field which accepts FontAwesome icon classes. It's a text field with the following regex: ^(fa(-[0-9a-zA-Z]+)+)( (fa(-[0-9a-zA-Z]+)+)+)*$ Plugging this regex string into regexr, it properly validates my chosen FontAwesome declaration: fa-solid fa-balance-scale-right fa-4x If the regexr link dies, the only custom setting is that I've configured it to be PCRE validation. However, when attempting to create a new record, it fails the regex operation. What is causing this validation to fail? Edited January 11 by Foxtrek_64 Add details about regexr config
Jim M Posted January 11 Posted January 11 PHP 7.4+ uses PCRE2 validation. Have you tried scaling back the value which you are inserting? Does the validation work with just "fa-solid"?
Foxtrek_64 Posted January 11 Author Posted January 11 3 minutes ago, Jim M said: PHP 7.4+ uses PCRE2 validation. Have you tried scaling back the value which you are inserting? Does the validation work with just "fa-solid"? I've tried with just fa-solid. It does not pass validation.
Jim M Posted January 11 Posted January 11 Please be advised I have tagged a developer to this topic for further review. Foxtrek_64 1
Solution Ryan Ashbrook Posted January 11 Solution Posted January 11 You are missing your beginning and end delimiters. Try this: /^(fa(-[0-9a-zA-Z]+)+)( (fa(-[0-9a-zA-Z]+)+)+)*$/i And then set Apply text formatter to Yes, and then set Formatting Option to All lower-case in case someone enters a valid Font Awesome icon class, but uppercase.
Foxtrek_64 Posted January 11 Author Posted January 11 Thanks Ryan! That seems to have resolved the issue.
Recommended Posts