Answer the question
In order to leave comments, you need to log in
How to write regular expressions in google sheets?
Hello.
And how to write regular expressions for google api?
I process the addresses that came from Prom ua.
The main address formats are
Стрый, № 3 (до 30 кг): ул. Почтовая, 5
Приколотное, №1: ул. Центральная, 32
Черкассы, Отделение №9 (до 30 кг): ул. Остафия Дашкевича, 34
Глеваха, №1: ул. Вокзальная, 11
Киев, №189 (до 30 кг): ул. Ялтинская, 24/23
Кучурган, №1: ул. Павла Каплуна, 71
Днепр
Ахтырка, №3 (до 30 кг на одно место): ул. Армейская (ран. Красноармейская), 89б
/(\w+)(,\s(.*[№]\s?\d+)(\s\((.+)\))?:\s(.+))?/
var address = orderList["orders"][i]['delivery_address'];
const matches = address.match(/(\w+)(,\s(.*[№]\s?\d+)(\s\((.+)\))?:\s(.+))?/);
Logger.log('address=',address);
Logger.log('matches=',matches);
if(matches!==null){
for (let u = 1; u <= 4; u++) {
Logger.log(matches[u]);
//Logger.log(orderList);
}
Answer the question
In order to leave comments, you need to log in
You may need to specify flags in a regular expression ( gmi ). If there is no g flag, . match () returns only the first match as an array, where the match is at index 0.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question