advancedforms / advanced-forms

WordPress plugin to create forms using Advanced Custom Fields
75 stars 14 forks source link

Use ".+" instead of ".*" for regexp where at least one symbol is required (merge tags) #123

Open scrobbleme opened 7 months ago

scrobbleme commented 7 months ago

This is a smaller improvement.

Especially with merge tags there are some regexps used, which also allow no characters. As there is always at least one character needed, the regexp could be improved.

I.e. instead of

if ( preg_match_all( "/{(.*?)}/", $input, $matches ) ) {

use

if ( preg_match_all( "/{(.+?)}/", $input, $matches ) ) {

(it could even be better to at least restrict the allowed symbols to only a very specific subset of characters (like the slug))

image image image