Users in my application will use the regex to specify which file(s) the application should take and which it should exclude, e.g. include files matching foo.*\.txt
However sometimes the filter will need to use value that can only be known by the application at runtime. For example, if the filter is foo[SPECIALVALUEHERE].*\.txt and the special value happens to be bar, the actual filter will be foobar.*\.txt
Which characters can be used for specifying the [SPECIALVALUEHERE]? I guess to avoid ambiguity, it would need to be not a special/reserved character in regex, and not a character that would occur in a file. Another requirement from the customer is that it must be one (or at most two or three) characters only, so stuff like %SPECIALVALUE% is out of the question.
Any suggestion which character or character combination can I use for this purpose.
On windows you can use for example
=which is not a special character in regex but is not allowed in filenames (here a table of characters that can’t be used in windows filenames). You can then replace the = with what you need.Otherwise on unix systems it is quite a mess as any byte sequence can be part of the filename without restrictions, here a reference question on serverfault, so, even if language agnostic, you should at least decide on which systems you are going to use the regex.