I am trying to grab device names from a list of accessories, but some include multiple device names. iPhone 11/XR
If it weren't for those doubles I just use (\w+\s+\w+), but I need to then include word, space, word/word. Where it gets tricky is that some are triple, 7/8/SE
IPHONE 12/12PRO BLU-ELEMENT CHRY BLSM > Want return IPHONE 12/12PRO
IPHONE 7/8/SE ROOTS 9 CARD FOLIO WALLET > IPHONE 7/8/SE
IPHONE 7/8+CASECO BROADWAY ST FOLIO R GD > IPHONE 7/8+
SAMSUNG S21+ BOND ST II FOLIO BLACK > SAMSUNG S21+
Any good ways to do this?
Hi @hudg16 ,
You can adjust my previous solution to a slightly different problem:
(^.*?\s.*?[+]|^.*?\s.*?\s)
This method says, take everything from the beginning of the line to the first space, then from the first space the plus sign OR, from the the first beginning of the line to the second space.
Hope this helps,
M.