The following regular expression will match the parameter and its value:
\bencounterId=(\d*)
The parentheses enable extraction of the value. Note the word boundary \b
which makes sure a parameter ending with encounterId
such as fooencounterId
is not matched.