boost::regex q'n

Started by
1 comment, last by supagu 18 years, 1 month ago
im writting a script file in the format: [something_random_here] { stuff = something else } can i use regex to find the lines
  • where * is a wild card, some string of arbitary length? or is that not the intent of regex library?
  • Advertisement
    Sure:
    ^\[.*\]$

    You have to escape the [] because they have a special meaning in the regex language. If you also want to capture what's inside the brackets, the expression would be:
    ^\[(.*)\]$
    hrmm that doesnt work, i've tried a few variations

    my string is:

    "[pickup]" with out the quotes
    the only thing that expression caught was ""
    :-/

    This topic is closed to new replies.

    Advertisement