The above site shows the correct regex but when I do it with PHP it doesn't show up certain names such as 'JJ5x5's White Top Hat'
Here is the PHP :
<?php
function newEcho($Value){
echo $Value . "<br>";
};
function cURLAuto($URL){
$Channel = curl_init();
curl_setopt($Channel, CURLOPT_URL, $URL);
curl_setopt($Channel, CURLOPT_RETURNTRANSFER, 1);
return curl_exec($Channel);
};
function autoMatchAll($String,$Pattern){
$Found = array();
$Match = preg_match_all($Pattern,$String,$Found);
return $Found;
};
function replaceMatch($String,$Pattern,$Subject){
return str_replace($Pattern,$Subject,$String);
};
$Count = 0;
$Output = cURLAuto("www.roblox.com/catalog/json?Subcategory=2&SortType=0&SortAggregation=3&SortCurrency=0&LegendExpanded=true&Category=2&PageNumber=1");
$AssetId = autoMatchAll($Output,'/"AssetId":[\d]+/');
$Name = autoMatchAll($Output,'/"Name":"[\w\s\d\-' . "\'" . ']+"/');
foreach($AssetId[0] as $Value){
newEcho(replaceMatch($Value,'"AssetId":',"") . ":" . replaceMatch(replaceMatch($Name[0][$Count],'"Name":"',""),'"',""));
$Count++;
};
echo $Output
?>
$Name
is where I am having problems with the regex cause it is showing only some of the names when displaying the running the code. The regex for the $Name
is
/"Name":"[\w\s\d\-\']+"/
But due to the fact I cannot use ' or " as the string I had to make it
'/"Name":"[\w\s\d\-' . "\'" . "]+/"
But could you help me with this as I would like to fix this.