I have this string
<meta itemprop="name" content="some text" />
I have no ideas how to write regular expression to get only some text
part of above string.
I have this string
<meta itemprop="name" content="some text" />
I have no ideas how to write regular expression to get only some text
part of above string.
i can recommend you looking at http://www.regular-expressions.info/, looking at Learning Regular Expressions or reading the book i've read ... http://shop.oreilly.com/product/9780596528126.do
and if you cant handle them; use QString::contains
and QString::split
to get to your result
This is your regex pattern. Here you go:
(?<=content=").*?(?=")
Part 1: (?<=content=")
Explanation: This does a "Positive Lookbehind" to verify a literal match to content=" before your desired text without including it inside of the actual match
Part 2: .*?
Explanation: This will look for anything between Part 1 and Part 3 and assign that as your match as few times (lazy) as possible
Part 3: (?=")
Explanation: This makes sure that there is a quotation mark (") after your matched text using a "Positive Lookahead"
Now, regarding how one would implement this into C++, I leave that up to you. I'm only answering for the regex pattern for what you're looking for.