[CMake] STRING REGEX MATCH

Brandon J. Van Every bvanevery at gmail.com
Fri Mar 31 00:39:47 EST 2006


How can I extract only a number [0-9]+ in 1 regex step?  Seems like I 
should be able to do it with parentheses, but it's not working.  The 
following is clear, and works, but what's the short way?

    STRING(REGEX MATCH "Version [0-9]+" VERSION_STRING ${CHICKEN_BANNER})
    STRING(REGEX MATCH "Build [0-9]+" BUILD_STRING ${CHICKEN_BANNER})
    # Haven't figured out how to do this in one regex.
    STRING(REGEX MATCH "[0-9]+" VERSION_NUMBER ${VERSION_STRING})
    STRING(REGEX MATCH "[0-9]+" BUILD_NUMBER ${BUILD_STRING})

${CHICKEN_BANNER} is

 )   ___                       
(__/_____) /)   ,    /)        
  /       (/      _ (/_   _ __ 
 /        / )__(_(__/(___(/_/ (_
(______)                       
Version 2, Build 3 - windows-mingw32-x86 - [ dload ptables ]
(c)2000-2005 Felix L. Winkelmann




More information about the CMake mailing list