# \[ExternalData\] ExternalData\_Expand\_Arguments with REGEX arguments - how to get matched files at configure time?

**URL:** https://discourse.cmake.org/t/externaldata-externaldata-expand-arguments-with-regex-arguments-how-to-get-matched-files-at-configure-time/7907
**Category:** Usage
**Created:** [April 14, 2023, 11:45am UTC](https://discourse.cmake.org/t/externaldata-externaldata-expand-arguments-with-regex-arguments-how-to-get-matched-files-at-configure-time/7907 "2023-04-14T11:45:34Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![menno](https://discourse.cmake.org/user_avatar/discourse.cmake.org/menno/32/2928_2.png) [@menno](https://discourse.cmake.org/u/menno)
#### Post date: [April 14, 2023, 11:45am UTC](https://discourse.cmake.org/t/externaldata-externaldata-expand-arguments-with-regex-arguments-how-to-get-matched-files-at-configure-time/7907/1 "2023-04-14T11:45:34Z")

</div>

When I issue the command `ExternalData_Expand_Arguments` with a `REGEX` argument to match multiple files, I was expecting to get all matched files as a return argument, but it returns the directory on which the `REGEX` operates. Of course, the ExternalData module is aware of all files matched, because during `make MY_DATA` these files are downloaded correctly.

How do I get the list of matched files at configure time?

```auto
ExternalData_Expand_Arguments(
  MY_DATA, 
  _dataFiles, 
  DATA{${CMAKE_CURRENT_SOURCE_DIR}/grids/,REGEX:.*cgns}}
)
message("_dataFiles => ${_dataFiles}")

```

and the output is

```cs
_dataFiles => /path/to/current/source/dir/grids

```

I expected the following

```cs
_dataFiles => /path/to/current/source/dir/grids/grid1.cgns;/path/to/current/source/dir/grids/grid2.cgns;/path/to/current/source/dir/grids/grid3.cgns
```

---

<div class="post-metadata">

### Author: ![menno](https://discourse.cmake.org/user_avatar/discourse.cmake.org/menno/32/2928_2.png) [@menno](https://discourse.cmake.org/u/menno)
#### Post date: [April 19, 2023, 7:49am UTC](https://discourse.cmake.org/t/externaldata-externaldata-expand-arguments-with-regex-arguments-how-to-get-matched-files-at-configure-time/7907/2 "2023-04-19T07:49:55Z")

</div>

After inspection of the ExternalData module, I found that the list of files can be found in the global properties `_ExternalData_MY_DATA_FETCH` and `_ExternalData_MY_DATA_LOCAL`. The latter property has no content, whereas the former property contains the list of files.
