marv_tech
MrPLC Member-
Content count
3 -
Joined
-
Last visited
Posts posted by marv_tech
-
-
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
-
Submitted04/10/22
-
Category
-
[HMI Sample Code] - Crimson 3.0 Simple String Validation Pattern Matcher
in Download Comments
Posted
Yeah, unfortunately Red Lion does not have a section and I saw other Crimson 3.0 code examples here when I searched.