# CMP0159

Added in version 3.29.

`file(STRINGS)` with `REGEX` updates `CMAKE_MATCH_<n>`.

In CMake 3.28 and below the `file(STRINGS)` command's `REGEX` option does not affect `CMAKE_MATCH_<n>` variables. CMake 3.29 and above prefer to update the `CMAKE_MATCH_<n>` variables using captures from the last match in the file, similar to the `string(REGEX MATCHALL)` command. This policy provides compatibility for projects that have not been updated to expect the behavior.

The `OLD` behavior for this policy is for `file(STRINGS)` with `REGEX` to not store capture groups in `CMAKE_MATCH_<n>` variables. The `NEW` behavior is to store the capture groups.

This policy was introduced in CMake version 3.29. It may be set by `cmake_policy()` or `cmake_minimum_required()`. If it is not set, CMake does not warn, and uses `OLD` behavior.

Note

The `OLD` behavior of a policy is deprecated by definition and may be removed in a future version of CMake.