Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8987379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:46:35+00:00 2026-06-15T21:46:35+00:00

This is a bare minimal example of a larger more complex dataset, just trying

  • 0

This is a bare minimal example of a larger more complex dataset, just trying to get my head around something.

> grep("X10\\.1+",c("X10.10","X10.11","X10.12"))
[1] 1 2 3

Now I would have expected only 2 to have been returned, since ‘+’ is supposed to be ‘1 or more of the preceding element’. I thought escaping the period (which I have to deal with so want to keep it in the example) could have been causing the issue.

> grep("X101+",c("X1010","X1011","X1012"))
[1] 1 2 3

So, my understanding of the functionality of ‘+’ is wrong?

CONCLUSION:

Thanks @James. So my understanding was the + was ‘ANOTHER 1 or more of the preceding element’ as opposed to what it actually means, which is ‘JUST 1 or more of the preceding element’.

11+ would have done what I was thinking (having an ADDITIONAL 1 or more 1’s after the first 1 etc). Cheers

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:46:37+00:00Added an answer on June 15, 2026 at 9:46 pm

    You need to signify that after any number of 1s, you want to match the end of the string. You use $ to do this.

    grep("X10\\.1+$",c("X10.10","X10.11","X10.12"))
    [1] 2
    

    Similarly, ^ matches the start of the string if you want to restrict that the match starts X10., rather than PX10. for instance which would be matched by the existing regex.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've reduced this example to the bare minimum code. I'm focusing on the 'this'
I tried to make a new bare git repository but I get this error:
This rails project is very bare-bones, just begun, so I haven't done any weird
Let us take this example scenario: There exists a really complex function that involves
Consider this minimal example: #include <memory> struct B { typedef std::shared_ptr<B> Ptr; }; struct
The bare-bones minimal example: #include <boost/iostreams/filtering_stream.hpp> #include <boost/iostreams/filter/bzip2.hpp> int main() { boost::iostreams::filtering_istream in; in.push(boost::iostreams::bzip2_compressor());
I obviously don't get this somewhere. I have created a UserControl, the bare bones
My models looks something like this (stripped down to the bare minimum for this
I am completely new to Web Development, still a student. Kindly bare this extremely
This question got me thinking about bare strings. When PHP sees a string that's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.