Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
Does boost::regex_search support branch sentence like (....)|(....)?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="James Kanze, post: 3541354"] Why wouldn't the '|' be interpreted as a meta-character here... Since it is here? It's not really clear what he wants to capture, and what not. Depending on the use, you might want two separate capture groups (in order to distinguish which side of the or was matched), or only one---in the latter case, you'll have to put the or in a capture group encapsulating both sides of it. I tend not to worry about extra capture groups, since it's easy enough to ignore them, so something like: ((\\d+)|([a-z]+)) would do the trick. (Except that in this particular case, you don't need capture groups at all, since all you're interested in is the complete expression. And of course, since | has the lowest precedence, just "\\d+|[a-z]+" is really all that would be needed.) [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
Does boost::regex_search support branch sentence like (....)|(....)?
Top