I am trying to match the first hexadecimal address from a line that can contain many hexadecimal addresses, but instead I get the last.
My request is:
preg_match('%.*(0x[0-9a-f]{8}){1}.*%', $v, $current_match);
where the $v
is a string like:
Line: 2 libdispatch.dylib 0x36eaed55 0x36eae000 + 3413
I would want to get 0x36eaed55
, but my regular expression for $current_match[1]
returns 0x36eae000
instead.
According to php documentation:
$matches[1]
will have the text that matched the first captured parenthesized subpattern, and so on.