Регулярное выражение для сопоставления новой строки в таблицах Google с использованием формулы

#regex #google-sheets-formula

Вопрос:

У меня есть блок текста

 ➤ What is your Linkedin profile URL if you have not connected with on Linkedin?: test url
another
yet another

Need to make changes to this event?
 

Где мне нужно извлечь текст

 **EXPECTED RESULT:**
test url
another
yet another
 

Я пробовал с

 =trim(REGEXEXTRACT($C$4,"n.*➤ What is your Linkedin profile URL if you have not connected with on Linkedin?:(.*)Need to make changes to event?"))
 

Ответ №1:

Вы можете использовать

 (?s)➤s Whats iss yours Linkedins profiles URLs ifs yous haves nots connecteds withs ons Linkedin?:(.*)Needs tos makes changess tos thiss event?
 

Смотрите эту демонстрацию регулярных выражений.

Подробные сведения:

  • (?s) — флаг модификатора одиночной строки, который . сопоставляет любые символы разрыва строки
  • ➤s и один или несколько символов пробелов
  • Whats iss yours Linkedins profiles URLs ifs yous haves nots connecteds withs ons Linkedin?: — литеральная What is your Linkedin profile URL if you have not connected with on Linkedin?: строка с одним или несколькими пробелами между словами
  • (.*) — Группа 1: любые нулевые или более символов, как можно больше
  • Needs tos makes changess tos thiss event? — литерал Need to make changes to this event? с одним или несколькими пробелами между словами.

Ответ №2:

пробовать:

 =JOIN(CHAR(10), FILTER(SPLIT(SUBSTITUTE(A1, CHAR(10), " "), " "), 
                 ISURL(SPLIT(SUBSTITUTE(A1, CHAR(10), " "), " "))))
 

введите описание изображения здесь