Regex regular expression — how?

Let's say I have the following string:
std::string str = "<a href="\"url\"">name link</a><a href="\"url\"">name link</a>";


How to use regular expressions to get content links?
With the regular season like no problem:
std::string str = "(.*)(<a href="\"">)(\\w*)(<\/a>)";</a>


But is it possible in C++ to get the contents of the links? I.e., the position in the string, for example.
In php, for example, it is feasible.

Or for such purposes you need to use std::string::find?
July 2nd 19 at 17:02
2 answers
July 2nd 19 at 17:04
Solution
And if you will

what?

but in the regular season (\\w*) will not catch your "name link" ;)

so with the regular season there are problems
While on the template. I.e. not considering any other cases of writing tag. Is it possible to get the value found? Please tell me - Chadd_Hane commented on July 2nd 19 at 17:07
: show your code works with the regular season - mina50 commented on July 2nd 19 at 17:10
: Yes, let there be not even a link, a link for example took. There is for example a phone line, check thus: "*[0-9]+" i.e. any number of characters at the beginning and then there are some numbers. How to get the numbers from the string? No text - Chadd_Hane commented on July 2nd 19 at 17:13
:
regex_match(const charT* str, match_results& m,
const basic_regex & e,
match_flag_type flags = match_default);

so let's match_results him. should not cause difficulties. - mina50 commented on July 2nd 19 at 17:16
: visit Busta W is an example - mina50 commented on July 2nd 19 at 17:19
Yeah, that is a prototype in PHP? In match_results return line? Correctly understood? Thanks, overlooked - Chadd_Hane commented on July 2nd 19 at 17:22
Yes. all the same. PHP is a wrapper over the standard regex liboy. so in all languages the principle is the same - mina50 commented on July 2nd 19 at 17:25
July 2nd 19 at 17:06
(<a href="[^">]+>)([^<]*)(<\/a>)</a>
is also not OK. but almost - Chadd_Hane commented on July 2nd 19 at 17:09
The regular season is half the battle as the value to? All 3 of f-and regex_* return bool - mina50 commented on July 2nd 19 at 17:12
: well, XS, in PHP the function expects the variable to which the result will be written to the array with the search results and how you do it, it is necessary Doku language to dig - Chadd_Hane commented on July 2nd 19 at 17:15

Find more questions by tags Regular expressionsBoostC++