# RegExp semver fails to compile

**URL:** https://discourse.cmake.org/t/regexp-semver-fails-to-compile/6424
**Category:** Usage
**Created:** [September 6, 2022, 5:13pm UTC](https://discourse.cmake.org/t/regexp-semver-fails-to-compile/6424 "2022-09-06T17:13:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![hinell](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hinell/32/2657_2.png) [@hinell](https://discourse.cmake.org/u/hinell)
#### Post date: [September 6, 2022, 5:13pm UTC](https://discourse.cmake.org/t/regexp-semver-fails-to-compile/6424/1 "2022-09-06T17:13:23Z")

</div>

Any idea why the following RegExp matching fails?

```bash
tee regexFailure.cmake <<EOL
string(REGEX MATCH "^([0-9][0-9]*)\\.([0-9][0-9]*)\\.([0-9][0-9]*)(-(([0-9][0-9]|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\\.([0-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*))?$" SEMVER "99.0.14-test.99")

include(CMakePrintHelpers)
cmake_print_variables(SEMVER)
EOL
cmake -P regexFailure.cmake

```

My issue on that was recently [closed](https://gitlab.kitware.com/cmake/cmake/-/issues/23938) by Brad.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [September 6, 2022, 5:30pm UTC](https://discourse.cmake.org/t/regexp-semver-fails-to-compile/6424/2 "2022-09-06T17:30:48Z")

</div>

CMake only supports 9 groups in regexes, so there are just too many parentheses in this expression.
