Note that your regex matches a literal .
, then captures a sequence of any 0+ chars other than linebreak symbols as many as possible up to the last !.
sequence and then matches {display:none}
. Since your text does not contain !
nor the next .
you have no match.
One way to get your matches is to use \w+
(=one or more word characters, those in the [a-zA-Z0-9_]
set) pattern inside Group 1:
\.(\w+){display:none}
See the regex demo
PHP demo:
preg_match_all('@\.(\w+){display:none}@', '.UlEa{display:none}.RNLW{display:inline}.jc0k{display:none}.Lyhf{display:inline}', $matches);
print_r($matches[1]); // => Array ( [0] => UlEa [1] => jc0k )