Escape string special characters for use in golang regexp
<p>I have an array of characters like this :</p>

<pre><code>chars := []string{".", "-", "(", ")"}
</code></pre>

<p>When I join them in regular way (<code>strings.Join(chars, "")</code>) and pass it to <code>regexp.MustCompile</code>, Its panic :</p>

<pre><code>panic: regexp: Compile(`[.-()]`): error parsing regexp: invalid character class range: `.-(`
</code></pre>

<p>How can I scape string special characters for use in golang regexp as a character not regexp operator?</p>