Closed bizzare closed 1 year ago
After submitting this, thinking it could be changed to allow "upper" or "lower" as options. Otherwise, "false" would just leave the value as is. The if statement would just have to be expanded a little
Thanks, @bizzare!
@bizzare: Just skimming this between meetings, doesn't this defeat the purpose of a regex
?
@dan-snelson Thanks for reviewing.
Almost, but not completely.
"regex" : "^(?i)(ACME)?[0-9]{5,}$",
This allows the users to type "acme12345" or "ACME12345" or "Acme12345" or "12345"
Currently I do not mind if users use ACME12345 or 12345, though I do not want "AcME12345" or"acme12345"
I have found in my own testing that I enter lowercase letters by default, get caught by the regex, then have to enter the capital letters and move on. I like the idea of allowing users to enter the lowercase/uppercase letters but forcing the admins preferred format. Lets the users have little more flexibility in entering while ultimately respecting what the admins want.
Probably a bit of a niche and nit-picky change ha!
I wanted to allow users to enter asset tags like "P12345" or "p12345" but still have them end up with a capital P. Using the regex i just tell users to use the capital, but with this change we can allow them to type lowercase or not and capture it as capital.
Added: capitalizeAssetTag="true" option to allow to flag if the asset tag should be forced to be capital letters. Aso The if statement to check for the flag, if "true" then we use tr to bring letters from lower case to upper case.
This allows the use of a case insensitive regex in the json for the assettag and users dont have to worry about capitalizing the letters.
Not sure the location of the capital option, but the user input boxes section seemed right, right next to the assetag option