[CMake] string replace first occurrence of a period using regex

Rolf Eike Beer eike at sf-mail.de
Sat Dec 15 07:33:22 EST 2012


Mikael Sundell wrote:
> First, thanks for cmake!
> In cmake, how can I easily replace the first period "." in a string with a
> substitute using regex and string replace?
> For example:
>   z
>   z.1
>   z.1.2.5
> With replacement ".so", "." becomes ".so" as in:
>   z.so
>   z.so.1
>   z.so.1.2.5
> My regex is improving but not fast enough :)
> Thanks,
> Mikael

"^([^.]*)\.(.*)" "\\1.so.\2"

Eike
-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121215/8abc86db/attachment.pgp>


More information about the CMake mailing list