masterial
masterial

Reputation: 2216

How do I remove meta tags from a string using C++?

Need help figuring out how to extract text from context (Honda from str), need something analogous to Perl regex

#include <iostream>
#include <string>

using namespace std;

int main(int argc, char* argv[]) {
    string str;
    str = "<make>Honda</make>";
    //Code to extract Honda from above string
    cout<<str<<endl;
    cin.get();
    return 0;
}

Upvotes: 0

Views: 256

Answers (2)

vayay
vayay

Reputation: 86

need something analogous to Perl regex

Is this a trick question? :) That "something" is PCRE: "Perl-Compatible Regular Expressions".

What you really need is libxml2, and the XPath query //meta/text().

Upvotes: 2

Marc
Marc

Reputation: 53

In C# (I don't know programming in C#), I know there is Regex but in C++ it may be included in external libraries

Upvotes: -1

Related Questions