String pattern matching expressions?

I'm not sure what you call the below but I'm trying to understand where
to start learning about writing expressions to iterate through C++ strings.

How do I learn how to search strings with expressions like ("\\b(sub)([^ ]*)");
What do you call this?

Thanks

1
2
3
  std::string s ("this subject has a submarine as a subsequence");
  std::smatch m;
  std::regex e ("\\b(sub)([^ ]*)");   // matches words beginning by "sub" 
I think you are looking for the term "regular expressions". It is actually being abbreviated as "regex" in the code snippet you show.
Yes, but I'm specifically trying to learn all the symbols and parenthesies / asterix etc I need to use, and what they mean to write the expression.

I found this link which seems to be helping.

http://www.informit.com/articles/article.aspx?p=2079020
Yes, but I'm specifically trying to learn all the symbols and parenthesies / asterix etc I need to use, and what they mean to write the expression.
That's what you'll learn if you read about regular expressions.
Start with a simple, minimal, tutorial introduction. For example: https://www.regexone.com/

Then move on to a more elaborate tutorial. For example: http://www.regular-expressions.info/tutorialcnt.html

Read up on the standard C++ regex library. For example: http://www.codeguru.com/cpp/cpp/cpp_mfc/stl/article.php/c15339/A-TR1-Tutorial-Regular-Expressions.htm
Topic archived. No new replies allowed.