I want to create a dynamic string variable that holds file extension from a configuration text file like this. The bad thing is that the string value contains regex expression:

```
EXCLUDE_EXTENSION="\.(log|txt|png)$"

```

where the log, txt and png extensions I get it from a text file called excluded\_ext.txt. So the content of the excluded\_ext.txt is:

```
log
txt
png

```

so whenever I add another extension in excluded\_ext.txt, I will get an updated extension inside the variable EXCLUDE\_EXTENSION. Example if I add an extra extension of 'log' inside excluded\_ext.txt

```
log
txt
png
log

```

then the value of variable EXCLUDE\_EXTENSION should be updated automatically to:

```
EXCLUDE_EXTENSION="\.(log|txt|png|log)$"

```

I think I might need to use regex but I'm not sure how to achieve this.

```
#!/bin/sh
# read from a text file
EXCLUDED_TEXT=`cat excluded_ext.txt`
# create array from the text file
# Im not sure how to go next.

```