@grous228 said in Как отделить цифры от текста:
Отправляю POST запрос получаю ответ OK|50226493767
Дальше мне нужно отправить GET запрос, только цифры нужно передать, как сделать?
710ec9a5-3c06-4b08-b3c8-784697857fb6-изображение.png
У меня есть строка
index.com/apps/index/:UNKNOWN:test
Нужно чтобы она превратилась в
index.com:UNKNOWN:test
@joeyyates7352 Replace
/apps/index/
на
пусто
You can use javascript to do complex stuff.
// Input string
const inputString = "index.com/apps/index/:UNKNOWN:test";
// Define a regular expression pattern to match the unwanted parts
const pattern = /\/apps\/index\/:([^/]+):([^/]+)/;
// Use the replace method to remove the unwanted parts
const resultString = inputString.replace(pattern, ' :$1:$2');
console.log(resultString);