<issue_start><issue_comment>Title: Use regex to substitute template strings
username_0: Though I doubt many projects will have enough input/output files and command elements for it to matter, this should make the replace linear.
<issue_comment>username_0: This also avoids (the admittedly slim chance of) recursive substitution, for instance:
~~~Meson
project('foo', 'c')

cl = find_program('cl')

config = configuration_data()

in = configure_file(configuration : config, output : 'IN')
put = configure_file(configuration : config, output : 'PUT2')

custom_target('zomg',
  input : [in, put, 'foo.c'],
  output : 'foo.exe',
  command : [cl, '@@INPUT0@@INPUT1@@']
)
~~~
results in `../foo.c` in the build file instead of `@INPUT2@` with the current version, because the expansion is done over the entire string one at a time.
<issue_comment>username_0: Added a regression test.
<issue_comment>username_0: The regression test fails on MSVC backends because they pass full paths for `IN` and `PUT2` to the script. Should I just remove the regression test?
<issue_comment>username_0: The test should work now, assuming no backend adds something to the end of the filename when it is substituted.

Whether it is worth the trade-off between creating an extra list vs the theoretically slower loop, I don't know.