Sign in to follow this  
supagu

boost::regex q'n

Recommended Posts

supagu    148
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?

Share this post


Link to post
Share on other sites
Sharlin    864
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:
^\[(.*)\]$

Share this post


Link to post
Share on other sites
supagu    148
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 ""
:-/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this