Note that there are some explanatory texts on larger screens.

plurals
  1. POBoost regex confusion
    primarykey
    data
    text
    <p>I've spent most of the day learning about regular expressions in an attempt to parse configuration files made by my program. Currently, the config file vaguely resembles an INI file, but it will be expanded later. It's structured like this</p> <pre><code>&gt; ##~SECTIONNAME~## &gt; #KEY#value/# &gt; #KEY#value/# &gt; #KEY#value/# &gt; ##~ANOTHERSECTION~## &gt; #KEY#value/# &gt; #KEY#value/# &gt; #KEY#value/# </code></pre> <p>What I'm trying to do is get the section names back as strings. My regular expression is #{2}~(.*)~#{2} and it's worked fine on an online perel regex tester. But when I run it through c++, I get odd results.</p> <pre><code> split_regex(sectionList,file,regex("#{2}~(.*)~#{2}")); </code></pre> <p>sectionList is a temporary data holder that will hold a list of the section names. File is a string with all that text from a loaded configuration file. What it currently does is give me a blank first index. The second index holds a string with everything below the LAST section.</p> <p>My ultimate goal is to have a vector of pairs, one holding the section list's text, the other holding another vector. The second vector will hold instances of a class that will hold the key and value (or maybe just another pair).</p> <p>What's a good way to go about this? I understand how to write regular expressions just fine now. But even after looking at the documentation of regular expressions in boost, I'm still not quite sure how to go about USING said regular expressions.</p> <p>Thanks for reading my question. I really appreciate you taking the time to do that. Any help would be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload