I want to validate user-specified version string - to ensure it consists of three period-separated numbers (e.g. 1.20.300
).
But i'm not sure how to write such regex, the code below is just a try:
if( PROJECT_VERSION MATCHES "([0-9]+).([0-9]+).([0-9+])" )
message( "NOTE: Valid version string" )
else()
message( FATAL_ERROR "Invalid version string" )
endif()
So, how to correctly write required regex?
Thanks.
UPD
My regex also matches 1.2.3.4
, but is should not!
Only three period-separated numbers are possible.