I have the following string:
SEDCVBNT S800BG09 7GFHFGD6H 324235346 RHGF7U S8-00BG/09 7687678
and the following regex:
preg_match_all('/\b(?=.+[0-9])(?=.+[A-Z])[A-Z0-9-\/]{4,20}/i', $string, $matches)
What I'm trying to achieve is return all the 'words' that:
- contain at least 1 number
- contain at least 1 letter
- may contain '/'
- may contain '-'
Unfortunately, the above regex returns:
Array ( [0] => Array ( [0] => SEDCVBNT [1] => S800BG09 [2] => 7GFHFGD6H [3] => 324235346 [4] => RHGF7U [5] => S8-00BG/09 ) )
I don't want 'SEDCVBNT' or '324235346' to be returned.
I've search high and low, tried so many small alterations to the above regex, but I'm just totally stuck on this. I'd really appreciate any help.
Thanks in advance.