Dear All,
This if my first post on this forum, so I apologize if it ended up in the wrong place.
I am trying to use the Regexp library that I got from this github: https://github.com/nickgammon/Regexp
I wish to implement the following regex expression from the standard <regex> library in c++11:
In essence, I want to detect the following possibilities:
1) R or V followed by [+/-decimal]
2) R followed by [+/-decimal] AND V followed by [+/-decimal]
Essentially, I am struggling to implement the AND part in the 2) case.
When I try to implement the above using Regexp, I can't do cover 1) and 2) using a single mask like I can using <regex> libraries.
I have to have two different masks.
I think the problem lies in fact that I do not know how to get Regexp to set the second submask as optional. Using <regex>, I would simply implement it as (submask1)(submask2)?.
Any ideas how to solve this?
Thanks a lot!
Anyways, Here is my solution which is incomplete. It only covers case 2)
This if my first post on this forum, so I apologize if it ended up in the wrong place.
I am trying to use the Regexp library that I got from this github: https://github.com/nickgammon/Regexp
I wish to implement the following regex expression from the standard <regex> library in c++11:
([R|V][-]?[[:digit:]]+([.][[:digit:]]+)?)?(V[-]?[[:digit:]]+([.][[:digit:]]+)?)? In essence, I want to detect the following possibilities:
1) R or V followed by [+/-decimal]
2) R followed by [+/-decimal] AND V followed by [+/-decimal]
Essentially, I am struggling to implement the AND part in the 2) case.
When I try to implement the above using Regexp, I can't do cover 1) and 2) using a single mask like I can using <regex> libraries.
I have to have two different masks.
I think the problem lies in fact that I do not know how to get Regexp to set the second submask as optional. Using <regex>, I would simply implement it as (submask1)(submask2)?.
Any ideas how to solve this?
Thanks a lot!
Anyways, Here is my solution which is incomplete. It only covers case 2)
^([R]([-]?)(%d+)([.]?)(%d*))(([V])([-]?)(%d+)([.]?)(%d*))$