Re: Regex replace help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Dec 4, 2011 at 9:20 AM, Haïkel Guémar <karlthered@xxxxxxxxx> wrote:
> AFAIK, CMake does not have multi-line regex, so it doesn't work. If you
> find a better trick, please share it :-]

Denis's email client replied to the list and me and I didn't catch
that gmail only replied to him directly so there was a bit of an
exchange that was off list. Here's the reult:

I got it working but I'm not entirely happy with how I had to do it.

Here's the final code:

       string(REGEX MATCH "const int TIXML_MAJOR_VERSION = ([0-9]+);"
_TMP_major "${_contents}")
       string(REGEX REPLACE ".*([0-9]+).*" "\\1" _OUT_major "${_TMP_major}")
       string(REGEX MATCH "const int TIXML_MINOR_VERSION = ([0-9]+);"
_TMP_minor "${_contents}")
       string(REGEX REPLACE ".*([0-9]+).*" "\\1" _OUT_minor "${_TMP_minor}")
       string(REGEX MATCH "const int TIXML_PATCH_VERSION = ([0-9]+);"
_TMP_patch "${_contents}")
       string(REGEX REPLACE ".*([0-9]+).*" "\\1" _OUT_patch "${_TMP_patch}")

I think it was the lines ending with a semi-colon that was causing the
problem. Apparently ".*" doesn't match that. I still don't know why it
mas matching the entire file up to the correct line...

Thanks all!

Richard
-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux