Regular Expression to match "\\r"
<p>I'm having trouble writing a regex that matches these inputs: <br>
1.<code>\\r</code><br>
2.<code>\\rSomeString</code>
<br>
I need a regex that matches <code>\\r</code></p>

<p>Escape the back slashes twice. String's interpret <code>\</code> as a special character marker.</p>

<p>Use <code>\\\\r</code> instead. <code>\\</code> is actually interpreted as just <code>\</code>.</p>

<p>EDIT: So as per the comments you want any string that starts with <code>\\r</code> with any string after it. The regex pattern is as follows:</p>

<pre><code>(\\\\r\S*)
</code></pre>

<p><code>\\\\r</code> is the string you want at the start and <code>\S*</code> says any non-white space (<code>\S</code>) can come after any number of times (<code>*</code>).</p>

python regex