# regex doesn't work in source\_group

**URL:** https://discourse.cmake.org/t/regex-doesnt-work-in-source-group/7506
**Category:** Usage
**Created:** [February 20, 2023, 9:33pm UTC](https://discourse.cmake.org/t/regex-doesnt-work-in-source-group/7506 "2023-02-20T21:33:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pavel\_krupets](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/258eb7/32.png) [@pavel\_krupets](https://discourse.cmake.org/u/pavel_krupets)
#### Post date: [February 20, 2023, 9:33pm UTC](https://discourse.cmake.org/t/regex-doesnt-work-in-source-group/7506/1 "2023-02-20T21:33:50Z")

</div>

cmake 3.24

```auto
add_executable(
    ${PROJECT_NAME}
    ${SOURCES_MCU_STARTUP}
    ${SOURCES}
    ${SOURCES_SHARED}
    ${SOURCES_MCU_DUAL_CPU_BOOT}
)
...
set_target_linker(${PROJECT_NAME} ${SOURCES_MCU_LOADER})
...
source_group(
    "startup"
    FILES
        ${SOURCES_MCU_STARTUP}
        ${SOURCES_MCU_DUAL_CPU_BOOT}
        ${SOURCES_MCU_LOADER}
    REGULAR_EXPRESSION
        ".+\.s")

```

I have 3 files in those lists, one `blah.c` one `blah.s` and one `blah.ld`. no matter what I put in regex I get `blah.c` and `blah.s`. if I change name of source group it changes just fine.

sadly `blah.ld` is never listed.

I want to see `blah.ld` in sources just in case I need to double check it and tweak it.

---

<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: [February 20, 2023, 10:46pm UTC](https://discourse.cmake.org/t/regex-doesnt-work-in-source-group/7506/2 "2023-02-20T22:46:09Z")

</div>

> [@pavel\_krupets](#):
>
> `${SOURCES_MCU_LOADER}`

I presume this is the `.ld` file. I don’t see it in the `add_executable` list of sources.

---

<div class="post-metadata">

### Author: ![pavel\_krupets](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/258eb7/32.png) [@pavel\_krupets](https://discourse.cmake.org/u/pavel_krupets)
#### Post date: [February 20, 2023, 11:14pm UTC](https://discourse.cmake.org/t/regex-doesnt-work-in-source-group/7506/3 "2023-02-20T23:14:31Z")

</div>

oh, I need to add not only c/cpp/h/hpp but any files there?  
thank you!

---

<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: [February 21, 2023, 12:35am UTC](https://discourse.cmake.org/t/regex-doesnt-work-in-source-group/7506/4 "2023-02-21T00:35:11Z")

</div>

If you want it associated with the target in question within an IDE (AFAIK, the only place `source_group` matters), yes.
