beginning with RegEx expession

Hi everyone, I want to find a text pattern using regular expresion.
I am using the regex library.

The fact is with any regular expresion throw an error.

Actually I need to find a windows alike path pattern into a text line file.
ie: C:\Peliculas

I used the following regex: "\\Peliculas", but if I try with "eliculas" or even "*" it doesn't work. An error is thrown.

I am using Ubuntu 12.04
gcc/g++ version is 4.6.3

Thanks a lot, regards


1
2
3
4
5
6
7
8
9
10
11
12
13
14
             #include <regex>
             ////  another code
  
             string spch = something ;
             try
                 {
                    std::regex e ("*");
                    if (std::regex_match (spch.c_str(),e))
                        cout << "found pattern " << endl;
                    else
                        cout << "didn't find pattern " << endl;
                 }
       catch (std::regex_error& e)
         // message error 

Last edited on
Could you post what the error is that is thrown? E.g. print out e.what() and paste it here.
This the output error into the terminal:

terminate called after throwing an instance of 'std:regex_error'
what(): regex_error
Aborted

Thanks for your help
Regards, rossig
Topic archived. No new replies allowed.