How do i use wildcards in my input mask in a PLC language (structured text)?
^^[0-9][0-9][A-Z][2][0]
main()
{
barcodeData = getBarcode();
if (match(barcodeData, "^^[0-1][0-9][2][0][P]*"))
{do something
}
else{dosomethingelse
}
}
This seems like a regular expression. There *
is not a wildcard but a quantifier. It means that the preceding character or group can occur zero or more times. .
is a wildcard. It means any character except newline. [...]
is a character set. It means any character from the set.
.
is a wildcard for one character.
.*
is a wildcard for any number of characters.
[.]
means exactly one dot.
.{4}
means four wildcards.
You can use sandboxes and cheatsheets like https://regexr.com/ to test your regular expressions.