In addition to @Marek’s comment about not including fixed==TRUE
, you also need to not have the spaces in your regular expression. It should be "A1|A9|A6"
.
You also mention that there are lots of patterns. Assuming that they are in a vector
toMatch <- c("A1", "A9", "A6")
Then you can create your regular expression directly using paste
and collapse = "|"
.
matches <- unique (grep(paste(toMatch,collapse="|"), myfile$Letter, value=TRUE))
Related Posts:
- Poker hand range chart visualization in R
- Emulate ggplot2 default color palette
- What is a Context Free Grammar?
- How to coerce a list object to type ‘double’
- What does na.rm=TRUE actually means?
- Remove legend ggplot 2.2
- Difference between \b and \B in regex
- whitespace in regular expression
- How do I use a regex in a shell script?
- Update R using RStudio
- Regular Expression for alphanumeric and underscores
- ‘x’ and ‘y’ lengths differ ERROR when plotting
- Regular Expression for alphanumeric and underscores
- python re.split() to split by spaces, commas, and periods, but not in cases like 1,000 or 1.50
- Drop data frame columns by name
- “Error: Continuous value supplied to discrete scale” in default data set example mtcars and ggplot2
- Is there a difference between /\s/g and /\s+/g?
- Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, …) 0 non-na cases
- What is a non-capturing group in regular expressions?
- plot.new has not been called yet
- R: need finite ‘ylim’ values in function
- How to save a data frame as CSV to a user selected location using tcltk
- Convert a list to a data frame
- How to use Regular Expressions (Regex) in Microsoft Excel both in-cell and loops
- Remove all special characters, punctuation and spaces from string
- Remove NA values from a vector
- How to use Regular Expressions (Regex) in Microsoft Excel both in-cell and loops
- character string is not in a standard unambiguous format
- Remove rows with all or some NAs (missing values) in data.frame
- Grep and Python
- duplicate ‘row.names’ are not allowed error
- Using Bash regex match (=~) where regex includes quotes (” characters)
- Error: unexpected ‘}’ in “}” in R [duplicate]
- Mean of a column in a data frame, given the column’s name
- Regex for string contains?
- Subscript out of bounds – general definition and solution?
- file.path function in R
- Reshaping data.frame from wide to long format
- Converting data frame column from character to numeric
- How to set limits for axes in ggplot2 R plots?
- What is the grep equivalent in Python?
- duplicate ‘row.names’ are not allowed error
- Python re.split() vs split()
- Error: invalid subscript type ‘list’ in R
- “non-numeric argument to binary operator” error in R
- install.packages fails in knitr document: “trying to use CRAN without setting a mirror”
- How is \\n and \\\n interpreted by the expanded regular expression?
- Function to calculate R2 (R-squared) in R
- Regular Expression to reformat a US phone number in Javascript
- Too few periods for decompose()
- R histogram range error: some ‘x’ not counted; maybe ‘breaks’ do not span range of ‘x
- What is the meaning of the dollar sign “$” in R function()?
- RegEx to find two or more consecutive chars
- Regex to match an optional ‘+’ symbol followed by any number of digits
- How do you specifically order ggplot2 x axis instead of alphabetical order?
- Regular Expressions on Punctuation
- How to represent a fix number of repeats in regular expression?
- How to initialize a vector with fixed length in R
- Efficiently sum across multiple columns in R
- RegEx match open tags except XHTML self-contained tags
- Extract hostname name from string
- How do I match any character across multiple lines in a regular expression?
- lib unspecified & Error in loadNamespace
- Error Error in storage.mode(x) <- "double" : 'list' object cannot be coerced to type 'double'
- Warning: non-integer #successes in a binomial glm! (survey packages)
- Python regex match space only
- What is the meaning of the dollar sign “$” in R function()?
- Regex empty string or email
- invalid (do_set) left-hand side to assignment in R
- Regex difference: (\w+)? and (\w*)
- Regex multiple match substring
- Java regex email
- sql query to put quotes around numbers in img tag
- Adding Automatically To In WordPress Using Filter Referencing?
- How to change the admin menu “Pages” to something else
- add_rewrite_rule isnt working, not getting added to rules array, why?
- Get shortcode attribute outside of WordPress
- get_shortcode_regex() only matches first shortcode
- What’s the “?P” register rest api construct, what is for and where to find official docs?
- String regex match replace for role ‘contributor’ only
- Get URL from shortcode tag
- Adding span tags to post titles using regex
- Preg_Match(): compilation failed unknown property name
- Get array of shortcodes within string
- Can an RSS item be altered with a hook?
- How to deal with WordPress bug: can’t use wrapped and unwrapped shortcode on same post
- WordPress rewrite rule doesn’t work unless post category is explicitly called in regex
- Custom taxonomy terms as children of multiple custom post types
- add_rewrite_rule with optional parameters
- Media Library Cleanup A Thought Exercise
- ACF – Eliminate unnecessary data and print
- Rewrite rule regex help required
- WP_Query Regexp whitespace and end of string
- Redirect files in uploads directory if WordPress user not logged in
- WordPress Own Rewrite Rules
- WordPress add_rewrite_rule
- Call Shortcode Attribute Value within another function
- Rewrite permalink to include multiple taxonomies
- Dynamically append custom post type to end of url
- How to cut a section of a URL from a string with a regular expression?