I have an input field where both regular text and sprintf tags can be entered. Example: some text here. %1$s done %2$d times
How do I validate the sprintf parts so its not possible them wrong like %$1s ? The text is utf8 and as far as i know regex only match latin1 characters.
www.regular-expressions.info doesnt list /u anywhere, which I think is used to tell that string is unicode.
Is the best way to just search the whole input field string for % or $ and if either found then apply the regex to validate the sprintf parts ?
I think the regex would be: /%\d\$(s|d|u|f)/u