Radek Simko
Radek Simko

Reputation: 16146

tr/regex c++ library - definition of regex pattern

How should i define the regex pattern, when i use the tr1/regex library?

#include <tr1/regex>

const regex pattern("[^-]-[^-]");

is not working... When compiling i get error: ‘regex’ does not name a type

Upvotes: 1

Views: 660

Answers (1)

JaredC
JaredC

Reputation: 5310

regex is in the tr1 namespace so you either need to declare that you are using tr1 or specify that regex is in the tr1 namespace:

using namespace tr1;

or

const tr1::regex pattern("[^-]-[^-]");

Upvotes: 3

Related Questions