Try "g\\+\\+.*$" -- the backslashes themselves need to be escaped
inside a CMake string first... (Then the regex parser will see it as
your original &quot;g\+\+.*$&quot;)<br><br>
The error is because CMake doesn&#39;t recognize &quot;\+&quot; as a string escape sequence.<br>
<br><div><span class="gmail_quote">On 5/11/07, <b class="gmail_sendername">James Bigler</b> &lt;<a href="mailto:bigler@cs.utah.edu">bigler@cs.utah.edu</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
How do I match a literal &#39;+&#39; in a regular expression?<br><br>This matches in grep (because it doesn&#39;t treat &#39;+&#39; as a special<br>character), but CMake says it can&#39;t compile it (for good reason if &#39;+&#39;
<br>is a special character).<br><br>&quot;g++.*$&quot;<br><br>I tried escaping the &#39;+&#39;, but that didn&#39;t work either:<br><br>&quot;g\+\+.*$&quot;<br><br>syntax error, unexpected cal_ERROR, expecting $end (3), when parsing
<br>string &quot;g\+\+.*$&quot;<br><br>I&#39;m trying to match string g++, g++-4.0 etc.<br><br>Thanks,<br>James<br>_______________________________________________<br>CMake mailing list<br><a href="mailto:CMake@cmake.org">
CMake@cmake.org</a><br><a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br>