I have the following list of strings:
$list = array(
'c1' => '{sometext...} 1tb hdd 1tb hdd {sometext...}'
'c2' => '{sometext...} 1tb hdd 1tb {sometext...}',
'c3' => '{sometext...} hdd 1tb hdd 1tb {sometext...}',
'c4' => '{sometext...} hdd 1tb hdd 1tb hdd {sometext...}'
);
and the following regular expression which should run on all strings, and if a match is found, return true otherwise, return false.
/(?<!hdd\s)(\dtb hdd \dtb){1,}(?!\shdd)/
As of now, my result set looks something like this:
'c1' => false,
'c2' => true,
'c3' => false,
'c4' => false
However, for the correct result, would be, to mark c4 as true instead. How could I change my regex, to achieve the desired result?
USE CASE: the use case for this would be, to correctly identify ambigous attributes in product title naming. In case1 and case3, it is easily decidable which capacity belongs to which storage device, however in the other two cases, it is not programatically decidable, because there is a hdd without a capacity value.
NOTE: Counting the number of hdd instances in the string is not a good solution, as in the {sometext...} part of the string, other instances of the text may appear as different kind of noise.