I have a problem that involves a string of fields, separated by commas. One of these fields begins and ends with a comma, which causes problems when the string is parsed. The solution I am currently looking at is using the Regex tool to find this field, which always ends up being 7 symbols long, always starts and ends with a comma, and always contains at least one letter and one number (example: ,sf4g7rd,). There are other fields that contain strings that are 7 characters long, but they do not contain numbers, and we do not want these to match - therefore, the expression must check this. After looking online at multiple regex test sites (listed below), the expression ,(?=.+[0-9])(?=.+[a-zA-Z])[\w]{7}, was found to work - it would match test cases: ,sd4fs8d, while not matching test cases: ,tdvanva, or ,ALBANYX, which is exactly what I need. However, when this same expression is used in the Regex tool on Alteryx, all 7-length strings were matched, including those with and without numbers. Why is this? Is there an expression that will get what I need done?
Regex Test sites:
- https://regexr.com/
- https://regex101.com/