पाइप और प्रश्नवाचक चिह्न

R में Intermediate Regular Expressions

Angelo Zehr

Data Journalist

यह या वह

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 में Intermediate Regular Expressions

चीज़ों को वैकल्पिक बनाना

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

str_view का परिणाम

R में Intermediate Regular Expressions

Greedy बनाम Lazy

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

str_view greedy का परिणाम

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

str_view lazy का परिणाम

R में Intermediate Regular Expressions

अभ्यास करते हैं!

R में Intermediate Regular Expressions

Preparing Video For Download...