Skip to content

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

@scrobbleme

Description

@scrobbleme

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions