## [Retina](https://github.com/m-ender/retina), <s>43</s> 39 bytes Byte count assumes ISO 8859-1 encoding. The trailing linefeed is significant. <pre><code>2=`. !$&@ T04`¶d`^^@! O`\W?. O`.\w+ \W </code></pre> Input is expected to be the sort order as a zero-based list without delimiters on the first line, and the string to be sorted on the second line, e.g. 120 fOo42BaR [Try it online!][1] [1]: http://retina.tryitonline.net/#code=Mj1gLgohJCZAClQwNGDCtmRgXl5AIQpPYFxXPy4KT2AuXHcrClxXCg&input=MjEwCmFBYUE5MDlVdUhXdzlnaDI