Thanks to the help provided by people from this forum, i’ve been able to extract, and split a string according to certain parameters. However, I now need to validate this string that i’ve extracted in a custom format.
The custom format can be either:
10Chars-PTE-01 (can range from 01-09) e.g. 1234567890-PTE-01; or
9Chars-PTE-01 (can range from 01-09) e.g. 123456789-PTE-03
Is there an activity or regex that can help me in validating this format? and subsequently returning a boolean value.
All advice and help will be greatly appreciated, thanks much in advance!
wow! thanks everyone for the quick replies! i’ve tested and though it works… i just realised my custom format has another variation to it e.g. T17FC0060B-PTE-01.
And although the first part of the string contains 10 characters, the regex returned “False”.
How do i incorporate even alphabets into the condition?
The code seems to work well to validate only alphanumeric characters. Though it validates well for anything below 9 characters, the result seems to return “True” even though if my string has more than 10 characters…
Thanks once again for helping me out on this this works perfectly!
Would i then be able to expand on this statement to include another acceptable format? e.g. i would like to accept this string input even if they omit the dashes like T17FC0060BPTE01
Is the statement as simple as “^\w{9,10}-PTE-0\d$|^\w{9,10}PTE0\d$” ?