Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Regex for capturing strings (with <code>\</code> for character escaping), for the .NET engine:</p> <pre><code>(?&gt;(?(STR)(?(ESC).(?&lt;-ESC&gt;)|\\(?&lt;ESC&gt;))|(?!))|(?(STR)"(?&lt;-STR&gt;)|"(?&lt;STR&gt;))|(?(STR).|(?!)))+ </code></pre> <p>Here, a "friendly" version:</p> <pre><code>(?&gt; | especify nonbacktracking (?(STR) | if (STRING MODE) then (?(ESC) | if (ESCAPE MODE) then .(?&lt;-ESC&gt;) | match any char and exits escape mode (pop ESC) | | else \\(?&lt;ESC&gt;) | match '\' and enters escape mode (push ESC) ) | endif | | else (?!) | do nothing (NOP) ) | endif | | -- OR (?(STR) | if (STRING MODE) then "(?&lt;-STR&gt;) | match '"' and exits string mode (pop STR) | | else "(?&lt;STR&gt;) | match '"' and enters string mode (push STR) ) | endif | | -- OR (?(STR) | if (STRING MODE) then . | matches any character | | else (?!) | do nothing (NOP) ) | endif )+ | REPEATS FOR EVERY CHARACTER </code></pre> <p>Based on <a href="http://tomkaminski.com/conditional-constructs-net-regular-expressions" rel="noreferrer">http://tomkaminski.com/conditional-constructs-net-regular-expressions</a> examples. It relies in quotes balancing. I use it with great success. Use it with <code>Singleline</code> flag.</p> <p>To play around with regexes, I recommend <a href="http://www.radsoftware.com.au/regexdesigner/" rel="noreferrer">Rad Software Regular Expression Designer</a>, which has a nice "Language Elements" tab with quick access to some basic instructions. It's based at .NET's regex engine.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload