Try "g\\+\\+.*$" -- the backslashes themselves need to be escaped
inside a CMake string first... (Then the regex parser will see it as
your original "g\+\+.*$")<br><br>
The error is because CMake doesn't recognize "\+" as a string escape sequence.<br>
<br><div><span class="gmail_quote">On 5/11/07, <b class="gmail_sendername">James Bigler</b> <<a href="mailto:bigler@cs.utah.edu">bigler@cs.utah.edu</a>> 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 '+' in a regular expression?<br><br>This matches in grep (because it doesn't treat '+' as a special<br>character), but CMake says it can't compile it (for good reason if '+'
<br>is a special character).<br><br>"g++.*$"<br><br>I tried escaping the '+', but that didn't work either:<br><br>"g\+\+.*$"<br><br>syntax error, unexpected cal_ERROR, expecting $end (3), when parsing
<br>string "g\+\+.*$"<br><br>I'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>