I search the board using "Regular Expression" and regex_search as keywords. I get "Sorry - no matches. Please try some different terms."
Anyway, I'm trying to get the output below using regex_search only. I'm playing it by ear because all I read seems to take me out the regex_search function. For instance out of all the great things I learned here, he cut it off right here:
These leaves us with:
Replace any * characters with .*
Replace any ? characters with .
Leave square brackets as they are.
Replace any characters which are metacharacters with a backslashified version.
Code:
#include <iostream>
#include <string>
#include <boost/regex.hpp>
using namespace std;
int main()
{
boost::regex expression( ""x*\.o"" );
string string1 = "How to re";
boost::smatch match;
while ( boost::regex_search( string1, match, expression,
boost::match_not_dot_newline ) )
{
cout << match << endl;
string1 = match.suffix(); } }
Code:
// Output needed: oH to tore
After over 30 hours of trying I found nothing that show me how to move back to the beginning to grab the {T} or how to store it for farther use. All of this and hundreds more ... after 30 hours, I still stuck. All I ask is how to move backwards or what do I have to do to get the first word in my result list in that order. I got enough below and more to take care of the rest I think.
Thanks in advance.
Code:
// boost::regex expression( "(\w)\o" ); // back reference DON'T WORK
// boost::regex expression( "[A-Z][a-zA-Z]*" ); // match first word, no symbols.
// boost::regex expression( "[A-Z][A-Za-z]*" ); // same as above
// boost::regex expression( "[a-zA-Z]+" ); // match all words and char only.
// boost::regex expression( "[^a-zA-Z0-9]+" ); // match symbols only.
// boost::regex expression( "[*.jpg]" ); // match word
// boost::regex expression( "[*.jpg]+" ); // with + inc any matching char
// boost::regex expression( "*.[ch]pp" ); // DON'T WORK FOR BOOST
// boost::regex expression( "[^B]" ); // don't find this char or sequence
// boost::regex expression( "[*B]" ); // Find all
// boost::regex expression( "B+" ); // find one or more
// boost::regex expression( "[a-z]+://" ); // get the header https://
// boost::regex expression( "yM?" ); // must find more than one char of one
// boost::regex expression( "{1}y" ); // match one DON'T WORK
// boost::regex expression( "( "( ?B)+" ); // will only get 4 char
// boost::regex expression( "( "( ?B)+" )"; // will only get 4 char
// boost::regex expression( "[ ?Bith]+" ); // find any of these
// boost::regex expression( "( ?ho)+" ); // whole word per line sequence
// boost::regex expression( "cow(ard|age|boy|l)?" ); // connect parts
// boost::regex expression( "^(\\D{2})" ); // get 5 char - (d) digit
// [^\5]
// [^(\k<1>)]
// [^${1}]
// boost::regex expression( "(\\D+)(\\s*)(cow|M(M)?)" ); // back up and M to M
//boost::regex expression( "[^M]+(y+ig)?[big(igbay|age|boy|l)?]?+(ho|M(y)?)" ); // works great
// boost::regex expression( "^(\\D{2})+(\\D{2}) " ); // don't find this char or sequence
// boost::regex expression( ".*\.o" ); // copy all o
// boost::regex expression( "x*\.o" ); // copy only first o
... but I still read nothing about:
These leaves us with:
Replace any * characters with .*
Replace any ? characters with .
Leave square brackets as they are.
Replace any characters which are metacharacters with a backslashified version.
Regular Expressions Tutorial
... boost::regex_search for what I'm trying to do.
flat assembler - View topic - Feature Request: Regular Expressions
Regular Expression Matching Can Be Simple And Fast
Benchmark of Regex Libraries
Qt 4.7: QRegExp Class Reference
Regular expression - Wikipedia, the free encyclopedia
Perl Regular Expression Syntax - Boost 1.43.0 ... now things are getting easier. It's a new way to do your abc's ... That took me until Junior High ... heehee
PS: After posting this thread now I see 4 links to Regular Expression below but 9 out of 10 they are not related. Going to read them now.
The new forum look is very nice and it feels smooth