There are many ways to do this.
string = "Hi There the file is in this directory: /Volumes/GAW-FS01/08_Video/02_Projects/ Plus/S/metadata.xml Thank you for your inquiry."
Funky:
"Volume#{string[/Volume(.*?).xml/, 1]}.xml"
Funkier, find the index of the strings and use the range to return the desired string
first = "Volume"
last = ".xml"
string[(string.index(first)) .. (string.index(last) + last.length)]
=> "Volumes/GAW-FS01/08_Video/02_Projects/ Plus/S/metadata.xml "
Not so funky, split the string by the start and end points and return the desired string
"Volume#{string.split('Volume').last.split('.xml').first}.xml"
=> "Volumes/GAW-FS01/08_Video/02_Projects/ Plus/S/metadata.xml"
Lastly, the way you'd probably want to do this
string[/Volume(.*?).xml/, 0]
=> "Volumes/GAW-FS01/08_Video/02_Projects/ Plus/S/metadata.xml"
You notice the first and last options are the same, despite the int passed changing between 0 and 1. The 0 captures the regular expressions used to match where the 1 does not.
string[%r[/Volumes/.*/\.xml]]?