Question: I just want to know how Queries and Connections in Excel Workbooks are connected as objects. I noticed that I can use ThisWorkbook.Connections("Name of my connection").Refresh but that is not the same as the name used in my Queries (as I have commented out in my code).

```
Sub EditAllWorkbookFormuals(Order As String)
For Each q In ThisWorkbook.Queries
 q.Formula = NewQuery(q.Formula, Order)
 'q.Refresh
 'ThisWorkbook.Connections(q.Name).Refresh
 ThisWorkbook.Connections(1).Refresh
Next
'ThisWorkbook.RefreshAll
End Sub

```

Answer: 
A generic BASH\_REMATCH solution handling any number of words and any separator.

```
local input="STACK OVER FLOW" pattern='([[:upper:]]+)([^[:upper:]]*)' result=""
while [[ $input =~ $pattern ]]; do
    result+="${BASH_REMATCH[1]::1}${BASH_REMATCH[2]}"                 
    input="${input:${#BASH_REMATCH[0]}}"
done
echo "$result"
# Output: "S O F"

```
Another option rather than bash regex would be to utilize bash parameter expansion substring `${parameter:offset:length}` to extract the desired characters:

```
$ read -ra arr <text.file ; printf "%s%s%s\n" "${arr[2]:0:1}" "${arr[3]:0:1}" "${arr[4]:0:1}"
SOF

```