Boru ve soru işareti

R ile Orta Düzey Düzenli İfadeler

Angelo Zehr

Data Journalist

Bunu mu şunu mu

lines <- c(
  "Karate Kid 2, Distributor: Columbia, 58 Screens",
  "Finding Nemo, Distributors: Pixar and Disney, 10 Screens",
  "Finding Harmony, Distributor: Unknown, 1 Screen",
  "Finding Dory, Distributors: Pixar and Disney, 8 Screens"
)
str_detect(lines, "Columbia|Pixar")
TRUE TRUE FALSE TRUE
R ile Orta Düzey Düzenli İfadeler

İsteğe bağlı yapmak

str_view(lines, pattern = "Distributor|Distributors")
str_view(lines, pattern = "Distributors?")

str_view sonucu

R ile Orta Düzey Düzenli İfadeler

Açgözlü vs. tembel

str_view("Toy Story 3 In Disney Digital 3D", ".*3")

str_view sonucu açgözlü

str_view("Toy Story 3 In Disney Digital 3D", ".*?3")

str_view sonucu tembel

R ile Orta Düzey Düzenli İfadeler

Hadi pratik yapalım!

R ile Orta Düzey Düzenli İfadeler

Preparing Video For Download...