<div class="gmail_quote">On Thu, Jan 20, 2011 at 8:06 AM, Michael Wild <span dir="ltr"><<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5">On 01/20/2011 02:01 PM, David Cole wrote:<br>
> On Thu, Jan 20, 2011 at 7:39 AM, Michael Wild <<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>> wrote:<br>
><br>
>> On 01/20/2011 12:10 PM, SF Markus Elfring wrote:<br>
>>>> Thanks for your help to make CMake better,<br>
>>><br>
>>> Is the command variant "string(REGEX REPLACE ...)" completely documented?<br>
>>><br>
>>> Can multiple variables be specified that will receive the data from the<br>
>>> evaluation of subexpressions in the passed regular expression?<br>
>>><br>
>>> Regards,<br>
>>> Markus<br>
>><br>
>> AFAIK no, but you can "misuse" if(<string|varname> MATCHES <pattern>)<br>
>> for this. It stores the groups in CMAKE_MATCH_<n> where <n> is {0..9}.<br>
>> Match 0 is always the whole match of <pattern> and match 1 is the<br>
>> contains the first group.<br>
>><br>
>> Michael<br>
>> _______________________________________________<br>
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Please keep messages on-topic and check the CMake FAQ at:<br>
>> <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
>><br>
><br>
><br>
> I think it's the case that the CMAKE_MATCH_* variables are set after *any*<br>
> regex matching operation, be it from an "if(... MATCHES ...)" or a<br>
> "string(REGEX" or "string(MATCH" command. Let us know if you find that not<br>
> to be true.<br>
><br>
> From the bottom of (<br>
> <a href="http://cmake.org/cmake/help/cmake-2-8-docs.html#command:string" target="_blank">http://cmake.org/cmake/help/cmake-2-8-docs.html#command:string</a> ) :<br>
><br>
> () Saves a matched subexpression, which can be referenced<br>
> in the REGEX REPLACE operation. Additionally it is saved<br>
> by all regular expression-related commands, including<br>
> e.g. if( MATCHES ), in the variables CMAKE_MATCH_(0..9).<br>
><br>
><br>
> HTH,<br>
> David<br>
><br>
<br>
</div></div>Ah, yes. I keep forgetting. Might I propose that the documentation about<br>
regular expressions be extracted into its own section and then be<br>
referenced from all commands that have a REGEX mode? Because,<br>
confusingly, the only documentation about regular expression is at the<br>
end of the string(REGEX REPLACE) command, but then uses if(... MATCHES<br>
...) as an example. For the reader of the if( MATCHES ) documentation,<br>
this isn't very discoverable, it doesn't even refer him to the<br>
string(REGEX REPLACE) command.<br>
<font color="#888888"><br>
<br>
Michael<br>
</font></blockquote></div><br><br>Me too. I had to go searching for "CMAKE_MATCH_" because I knew it was stated somewhere. Much to my surprise, there was only a single "CMAKE_MATCH" on our whole documentation page. It would make sense to document the variables CMAKE_MATCH_0 and friends explicitly. And cross-referencing left, right, north and south would also be good.<br>
<br>You can propose all you want. I keep getting distracted by the "real bugs" on my plate...<br><br>:-)<br><br>