# Having issue with Cmake "string sub-command REGEX, mode REPLACE needs at least 6 arguments total to command."

**URL:** <https://discourse.cmake.org/t/having-issue-with-cmake-string-sub-command-regex-mode-replace-needs-at-least-6-arguments-total-to-command/8310>\
**Category:** Code\
**Created:** [June 11, 2023, 11:04pm UTC](https://discourse.cmake.org/t/having-issue-with-cmake-string-sub-command-regex-mode-replace-needs-at-least-6-arguments-total-to-command/8310 "2023-06-11T23:04:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kikendo](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kikendo/32/3521_2.png) [@kikendo](https://discourse.cmake.org/u/kikendo)\
**Post date:** [June 11, 2023, 11:04pm UTC](https://discourse.cmake.org/t/having-issue-with-cmake-string-sub-command-regex-mode-replace-needs-at-least-6-arguments-total-to-command/8310/1 "2023-06-11T23:04:41Z")

</div>

I have inherited a project for which I can have no help of those who I inherited it from, and am running into a wall that I cannot comprehend. I hope someone here can shed some light to help this absolute noob understand what’s going on and maybe fix it.

I have a project that uses CMake to build the project, and when I try to “make” it, I get the error:  
“/cmake/version.cmake:9 (string): string sub-command REGEX, mode REPLACE needs at least 6 arguments total to command.”

What does this even mean?  
The line 9 in question reads:  
“string(REGEX REPLACE “^v([0-9]).([0-9]).\*$” “\1;\2” GIT\_FULL\_VERSION ${GIT\_DESCRIPTION})”

It also gave this error:  
“Generating version information using git  
fatal: No names found, cannot describe anything.”

Hope anyone can help ☹ I’m pretty desolate.

---

<div class="post-metadata">

**Author:** ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)\
**Post date:** [June 12, 2023, 6:37am UTC](https://discourse.cmake.org/t/having-issue-with-cmake-string-sub-command-regex-mode-replace-needs-at-least-6-arguments-total-to-command/8310/2 "2023-06-12T06:37:33Z")

</div>

For me it looks like the thing that should fill `GIT_DESCRIPTION` does not work correctly. The variable is empty, it gets substituted by nothing, thus the `string` command is one parameter short.  
This seems to be confirmed by the other error you got.

So you have to debug the code that is supposed to generate `GIT_DESCRIPTION`.

---

<div class="post-metadata">

**Author:** ![kikendo](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kikendo/32/3521_2.png) [@kikendo](https://discourse.cmake.org/u/kikendo)\
**Post date:** [June 12, 2023, 12:48pm UTC](https://discourse.cmake.org/t/having-issue-with-cmake-string-sub-command-regex-mode-replace-needs-at-least-6-arguments-total-to-command/8310/3 "2023-06-12T12:48:44Z")

</div>

Thank you VERY much for that! I tracked the bug down thanks to your info and it was caused by the repository not having a release tag on Github. I think version.cmake should include a check for this that wasn’t there, so I need to look into making one!
