Having the following string:
<str1> <str2> <str3>
I am trying to do the regex such that I get the following 3 strings in C:
str1
str2
str3
I am trying to use the following regex but it doesn't seem to be yielding what I am aiming for:
<[a-zA-Z0-9]*.>
According to http://www.myregextester.com/index.php, that regex is going to yield
<str1>
<str2>
<str3>
How can I take out the <>'s?
Also, I'd also like to ONLY match strings with format, i.e., with 3 <>'s, no more, no less. How to approach that?
This can be easily done with a perl-compatible regular expression like this:
<([^>]+)>
You just have to make sure to tell your library to search for all matches, instead of trying to match the regular expression against the whole string. You will end up with str1, str2 and str3 as the first group match then.
What if you change it for <([a-zA-Z0-9]*.)>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With