Reputation: 4666
How to parse this text for:
34
http://... (before ,5|)
5
http://... to end
Previously it was done so:
if (preg_match_all('#|(.*?),#', $urlmap, $b)) {
}
Sorry for baaaaad english
Upvotes: 4
Views: 1241
Reputation: 455030
Try using:
if(preg_match_all('#\d+\|(.*?),#',$urlmap,$b))
there is a number before |
we need to consider and also |
is a meta char in regex, so we need to escape it. But this not give you the complete URL.
Instead you can split
the input on the pattern digits|
as:
$arr = preg_split('/\d+\|/',$input,-1, PREG_SPLIT_NO_EMPTY );
EDIT:
Upvotes: 3