marv_tech Posted April 10, 2022 Report Posted April 10, 2022 View File Crimson 3.0 Simple String Validation Pattern Matcher I developed this for work and thought I would share. It can be used for input validation and we needed it to enable validation of scanner gun input through the USB port. I also use it for serial input validation. Usage is: pattern.isMatch(input string, input pattern) which will return 1 if match, 0 if not a match I have also included toUpperCase and toLowerCase functions for strings. To use in your project, simply copy the pattern program folder to your project. This can be auto-migrated to crimson 3.1. Pattern string syntax is described in the comments or by clicking the guide button. Worth using this testbed to debug your pattern strings before using in a production environment. The controls and bits on the right side of the test page allow you to tab through your pattern and the string and see what matches each char. You can see a mockup of a real world batch-entry view on the "Demo" page and edit the input fields to try to defeat the validation. If you end up using it, toss a thanks my way if you can. If you find any bugs, please let me know. Built with Crimson 3.0 v707.000, tested in built-in emulator and used on Graphite G07s with both Crimson 3.0 and 3.1 runtimes. Submitter marv_tech Submitted 04/10/2022 Category HMI Sample Code Quote
pturmel Posted April 10, 2022 Report Posted April 10, 2022 Did you realize you put this in an Allen-Bradley category? Quote
marv_tech Posted April 13, 2022 Author Report Posted April 13, 2022 Yeah, unfortunately Red Lion does not have a section and I saw other Crimson 3.0 code examples here when I searched. Quote
Kev@B&W Posted January 12, 2023 Report Posted January 12, 2023 Marv, the program you have posted for the string validation pattern matcher has been a massive help with a project that I am currently working on. I'm using it to check and validate barcodes are scanned into the correct data entry fields. A massive thanks for sharing. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.