in reply to Re^2: Need a Regular Expression that tests for words in different order and captures the values found.
in thread Need a Regular Expression that tests for words in different order and captures the values found.
Heh, I just replied with this very solution (see below). Put a question mark after each closing parenthesis and it should work.
--marmot$line =~ /^(?=.*fred\s+(\w+))?(?=.*barney\s+(\w+))?(?=.*joe\s+(\w+))?/ + ; $company = join '_', $1, $2, $3, 'inc';
|
|---|