Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted January 11, 20241 yr 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, 20241 yr by Foxtrek_64 Add details about regexr config
January 11, 20241 yr 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"?
January 11, 20241 yr Author 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.
January 11, 20241 yr Solution 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.