How match with pattern and "like" operator escaping sware brackets ([]) in .net
<p>This method returns true when it shouldn't</p>

<pre><code>pattern = "*[cryptservice@inbox.ru]*"
file = "test.pdf"
    If file Like pattern Then
        MsgBox("like method, file: " &amp; file)
    End If
</code></pre>

<p>for every file i put into the var file, i get true in this line:</p>

<pre><code>If file Like pattern Then
</code></pre>

<p>the real true should appear at </p>

<pre><code>file = "P0LRBE2RUK[cryptservice@inbox.ru].awes0me"
</code></pre>

<p>So, how can I escape the square bracket ([]) for a search Pattern (not regex)</p>

<p>BTW I've a list of pattern from an API (<a href="https://fsrm.experiant.ca/" rel="nofollow noreferrer">https://fsrm.experiant.ca/</a>), and i can't use:</p>

<pre><code>For Each file In IO.Directory.GetFiles(path, pattern,IO.SearchOption.AllDirectories)
</code></pre>

<p>Because the IO.Directory.GetFiles throw an exception for denied folders</p>