I am working on a PHP script that parses ads, and I want to add a regex to find special codes, that are words that can be any length, but consist of both letters and numbers in any order or any length. I am just not sure what the proper syntax would be for this. I have found patterns that allow either letters or numbers, or require specific patterns of letters and numbers, but not an almost random mix.
Any advice would be greatly appreciated.
Sample: Buy Widgets 20% discount with coupon code WID2010 by Friday
Ideally, I’d want to detect the word “WID010” and use it to flag the item for other uses. That format, however, is not necessarily consistent. All that can be predicted is the codes always consist of at least one letter and one number, no spaces or punctuation.
Such a code does either consist of
written as a capture group: