[CMake] Regex Alternation

Michael Wild themiwi at gmail.com
Tue Jul 26 10:46:40 EDT 2011


Both work, but the meaning is different. In (this|that) the alternation
is restricted to within the group defined by the brackets, in
(this)|(that) you get two groups, one of which is always empty, and the
alternation is between everything left or right of the | operator.

Michael

On 07/26/2011 04:31 PM, David Cole wrote:
> "(this|that)" works.
> 
> 
> On Tue, Jul 26, 2011 at 10:10 AM, Allen Barnett <allen at transpireinc.com> wrote:
>> Hi: I was wondering how the alternation character, |, works in CMake
>> regular expressions. To match "this" or "that" in a longer string would
>> it be "(this|that)" or "(this)|(that)"? The CMake --help says | is
>> supported but header file kwsys/RegularExpression.hxx.in doesn't mention
>> it.
>> Thanks,
>> Allen
>> --
>> Allen Barnett
>> Transpire, Inc
>> E-Mail: allen at transpireinc.com




More information about the CMake mailing list