Try using:
if(preg_match_all('#\d+\|(.*?),#',$urlmap,$b))
there is a number before | to be considered, as well as | is a meta char in the regular expression, so we need to avoid it. But that does not give you the full URL.
Instead, you can split type digits| as:
$arr = preg_split('/\d+\|/',$input,-1, PREG_SPLIT_NO_EMPTY );
EDIT:
Working example
source share