Implement tab completion Tab completion is a useful feature that auto-completes partially written commands.  You're going to be implementing it.
For example, if the available commands were ['apply','apple','apple pie','eat'], then a would complete to  appl, as all of the commands that start with a also start with appl.
Input/Output
You need to input a string, A, and a set of strings, B.
You need to output the longest common prefix of all B that starts with A.

If none of the options starts with A, then return A
You can assume that B is nonempty, and that all strings are nonempty
You cannot assume that any of the options start with A, nor that the common prefix will be longer than A
You can be case sensitive or case insensitive.
You only need to handle printable ASCII
Built-ins that explicitly do this task are allowed

Test cases:
'a'       ['apply','apple','apple pie','eat'] =&gt; 'appl'
'a'       ['apple pie']                       =&gt; 'apple pie'
'apple'   ['eat','dine']                      =&gt; 'apple'
'program' ['programa','programb']             =&gt; 'program'
'*%a('    ['*%a()-T&gt;','*%a()-T&lt;','@Da^n&amp;']    =&gt; '*%a()-T'
'a'       ['abs','absolute','answer']         =&gt; 'a'
'a'       ['a','abs']                         =&gt; 'a'
'one to'  ['one to one','one to many']        =&gt; 'one to '

Note the trailing space on the last test case
This is a code-golf, so make your answers as short as possible!
JavaScript (ES6), 75 bytes

(s,a)=&gt;/^(.*).*(\n\1.*)*$/.exec(a.filter(e=&gt;e.startsWith(s)).join`
`)[1]||s


Explanation: Filters on all matching prefixes, then joins with newlines and matches against a regex that finds the longest common prefix of all lines. If there are no prefixes then the regex returns an empty string in which case we simply return the original string.