Mike Zambrzuski Posted February 17, 2021 Share Posted February 17, 2021 I need to find rows of data that match a very specific string format and conditionally classify them as a specific value. An example of what I'm looking to create is below: I'm looking for any rows of data where the [text] column contains precisely the following, in this exact order: Open parantheses The letter "x" A space A number (one or multiple digits) Quotation marks Close parentheses Examples of text that matches precisely this requirement are as follows: (X 36") (x 22") (X 105") I've been beating my head against a wall with RegEx and cannot figure out how to do this. Any help is very welcome! Link to comment Share on other sites More sharing options...
Fabian Duerr Posted February 18, 2021 Share Posted February 18, 2021 Please try: RXExtract([stringCol],"[Xx] [0-9]+""",1) Learn more about regular expressions: https://cran.r-project.org/web/packages/stringr/vignettes/regular-expres... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now