Validate a string using a filter or least amount of operations


I have a value I am collecting from a webhook lets call it ‘message’. I am trying to validate this message to match an expected format which is a 5-digit zipcode plus the # character (i.e. 45678#, 12345#, 45890# etc.). What is the best to go about check that all the characters prior to the # sign are indeed a number and not a letter or special character? This would be no problem for me in a coding persecptive, but not very good with this platform yet so looking for advice. I am already checking that the # sign is in the 5th position of the array plus the expected length of the string is 6 characters. Thanks in advance!


You can use a regex for that.


something like that :slight_smile:

1 Like