r - Is it possible to use an AND operator in grepl()? -
i want search begins 55 , has word roof (case-sensitive, curious) in it.
so far have been unsuccessful, can seem use or operator:
grepl("*^55|*roof", dataset$longname) ultimately, want achieve this:
grepl("*^55&&*roof", dataset$longname) or
grepl("*^55&*roof", dataset$longname) (clearly, neither of these work - they're illustration only.)
i want results show begins 55 , has word roof anywhere in it.
for example, expect both of these results picked grepl() function:
55 - roof structure and
55-wall roof is there and operator can used grepl()?
to search string having both "a" , "b"
grepl("a", x) & grepl("b", x) or
grepl("a.*b|b.*a", x) if know order of 2 parts can omit 1 of 2 halves of last grepl. example, in case of query in question sufficient find string starts 55 , contains roof
grepl("^55.*roof", x)
Comments
Post a Comment