I've worked with regexes for years and never had this much trouble working out a regex. I am using PHP 7.2.2's preg_match() to return an array of matching numbers for parsing, hence the parentheses in the regex.
I am trying to match one or more numbers followed by an x followed by one or more numbers where the entire string is not followed by a hyphen. When $input is 18x18, 18x18- or 18x18size, the matches are 18 and 1. When the $input is 8x8, there are no matches.
I seem to be doing something fundamentally wrong here.
<?php
$input = "18x18";    
preg_match("/(\d+)x(\d+)[^-]/", $input, $matches);
Calling the print_r($matches) results in:
Array
(
    [0] => 18x18
    [1] => 18
    [2] => 1
)
The parens are there because I am using PHP's preg_match to return an array of matches. I understand when hyphens should be escaped and I've tried both ways to be sure but get the same results. Why doesn't this match?
 
    