-7

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
        }
    }
teddy
  • 1
  • 2
  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackoverflow.com/rooms/196297/discussion-on-question-by-teddy-input-mask-wildcards-in-a-plc-language-i-need-t). – Samuel Liew Jul 11 '19 at 02:17

1 Answers1

0

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.

Thomas Sablik
  • 16,127
  • 7
  • 34
  • 62