const regex = /(https?):\/\/([0-9a-z.\-\/]+)/g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(https?):\\/\\/([0-9a-z.\\-\\/]+)', 'g')
const str = `<div class="filefield-file"><img class="filefield-icon field-icon-application-vnd-ms-excel" alt="application/vnd.ms-excel icon" src="http://uristhome.ru/sites/all/modules/filefield/icons/x-office-spreadsheet.png"><a href="https://uristhome.ru/sites/default/files/doc/ks-6a.xls" type="application/vnd.ms-excel; length=51712" title="ks-6a.xls">Типовой бланк и форма КС-6а</a></div>
`;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
procedure TMainForm.ButtonClick(Sender: TObject);
var
men: TMatchCollectionEnumerator;
begin
men := TRegEx.Matches('one two three', '\w+').GetEnumerator;
while men.MoveNext do
begin
men.Current.Value
end;
men.Free;
end;
http://www.trafficengland.com/api/events/getAlerts?start=0&step=100&order=Severity&is_current=1&events=CONGESTION,FULL_CLOSURES,ROADWORKS,INCIDENT,WEATHER,MAJOR_ORGANISED_EVENTS,ABNORMAL_LOADS&unconfirmed=false&completed=false&includeUnconfirmedRoadworks=true&_=1573508267254
http://www.trafficengland.com/api/events/getAlerts?start=100&step=100&order=Severity&is_current=1&events=CONGESTION,FULL_CLOSURES,ROADWORKS,INCIDENT,WEATHER,MAJOR_ORGANISED_EVENTS,ABNORMAL_LOADS&unconfirmed=false&completed=false&includeUnconfirmedRoadworks=true&_=1573508267255
$Street = new stdClass();
$Street->street_name = "Генерала Лизюкова";
$Street->street_type = "улица";
$City = new stdClass();
$City->city_name = "Воронеж"
$MyObjectItem = new stdClass();
$MyObjectItem->street = $Street;
$MyObjectItem->city = $City;
$MyObject = new stdClass();
$MyObject->count = 1;
$MyObject->items = []; // Сюда положим объекты
$MyObject->items[] = $MyObjectItem;
file_put_contents('data.json', json_encode($MyObject));