Skip to main content
gamedev.net
🔒 Locked

Boost regex groups

Started by Kranar Dec 29, 2004 at 4:22 PM 0 replies 750+ views
Original Post
Kranar
Kranar
I have looked as much as I could on the internet and boost documentation for sub-group matches and can't find anything on the matter. Basically say I have a simple expression like this: "(\\d{5,5})-(\\d{3,3})" And want to match it against the following string: "12345-678" In every implementation of regex I've seen, you could extract the actual number 12345, and 678 by extracting them as groups in a very simple and straight forward manner. Specifically this could be done in Java and Python. Was hoping there is also a simple way to do this in Boost.RegEx. Thanks.
Sharlin
Sharlin
The subexpressions are returned as sub_match objects inside a match_results object if you pass one to the matcher functions. Here's a nice example.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.