Wyodrębnianie dopasowań i otoczenia z tekstu

Wyrażenia regularne w R – poziom średnio zaawansowany

Angelo Zehr

Data Journalist

Wzmianki o nazwie firmy

"...got to the store. Super smooth and seamless experience. Great value. I would highly recommend ABC Enterprises and I will be coming back for sure! Next, we went..."

Jedno słowo: (\\w+\\s), od 0 do 10 słów: (\\w+\\s){0,10}

str_extract_all(
  blog_post,
  pattern = "(\\w+\\s){0,10}ABC Enterprises\\s?(\\w+\\s){0,10}"
)

Zwraca: "I would highly recommend ABC Enterprises and I will be coming back for"

Wyrażenia regularne w R – poziom średnio zaawansowany

Znaki interpunkcyjne

"...got to the store. Super smooth and seamless experience. Great value. I would highly recommend ABC Enterprises and I will be coming back for sure! Next, we went..."

Wyodrębniony fragment: "I would highly recommend ABC Enterprises and I will be coming back for"

Zastąp \\w+ przez [\\w[:punct:]]+

Wyodrębniony fragment: "smooth and seamless experience. Great value. I would highly recommend ABC Enterprises and I will be coming back for sure! Next, we "

Wyrażenia regularne w R – poziom średnio zaawansowany

Czas na ćwiczenia!

Wyrażenia regularne w R – poziom średnio zaawansowany

Preparing Video For Download...