# Change in string / regex behavior with cmake 4.3

**URL:** https://discourse.cmake.org/t/change-in-string-regex-behavior-with-cmake-4-3/15597
**Category:** Code
**Created:** [April 8, 2026, 4:08am UTC](https://discourse.cmake.org/t/change-in-string-regex-behavior-with-cmake-4-3/15597 "2026-04-08T04:08:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![opoplawski](https://discourse.cmake.org/user_avatar/discourse.cmake.org/opoplawski/32/3829_2.png) [@opoplawski](https://discourse.cmake.org/u/opoplawski)
#### Post date: [April 8, 2026, 4:08am UTC](https://discourse.cmake.org/t/change-in-string-regex-behavior-with-cmake-4-3/15597/1 "2026-04-08T04:08:15Z")

</div>

A package I’m building has:

```auto
      FILE(STRINGS "${_H5_I_PUB_ABS_PATH}" _h5_i_pub_contents)
      FOREACH(_line IN LISTS _h5_i_pub_contents)
        SET(_match)
        STRING(REGEX MATCH "^[\t]*typedef .*hid_t.*" _match "${_line}")
        IF(_match)
          SET(HDF5_TYPEDEF_HID_T "${_match}")
          BREAK()
        ENDIF()
      ENDFOREACH()

```

and then used to create a templated file with:

```auto
@HDF5_TYPEDEF_HID_T@

So it’s matching the following line:

```

```auto
typedef int64_t hid_t;

```

Prior to 4.3 that line would be output verbatim, but now it strips the trailing semi-colon:

```auto
typedef int64_t hid_t

```

Is this expected? How can I avoid it?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [April 8, 2026, 9:19pm UTC](https://discourse.cmake.org/t/change-in-string-regex-behavior-with-cmake-4-3/15597/2 "2026-04-08T21:19:50Z")

</div>

This seems unexpected to me. Could you please [open a bug report](https://gitlab.kitware.com/cmake/cmake/-/issues/new?type=ISSUE) in CMake’s issue tracker with the above information?

---

<div class="post-metadata">

### Author: ![opoplawski](https://discourse.cmake.org/user_avatar/discourse.cmake.org/opoplawski/32/3829_2.png) [@opoplawski](https://discourse.cmake.org/u/opoplawski)
#### Post date: [April 15, 2026, 1:13am UTC](https://discourse.cmake.org/t/change-in-string-regex-behavior-with-cmake-4-3/15597/3 "2026-04-15T01:13:53Z")

</div>

Issue filed here and fixed [https://gitlab.kitware.com/cmake/cmake/-/work\_items/27749](https://gitlab.kitware.com/cmake/cmake/-/work_items/27749)
