Это немного более надежно, чем некоторые альтернативы.
[&?]_id=([a-f0-9]+)(?:[&]|$)
[&?] # makes sure it isn't part of another parameter
_id=
(
[a-f0-9]+ # at least one hexadecimal digit
)
(?:
[&] # make sure there isn't some trailing data
|
$ # might be at the end of the string
)