Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>(?ms)^\s*([^\-/\s][^;]+;)((?:(?:\s+/\*(?:.(?!\*/))+.\*/)|(?:\s+\-\-[^\r\n]+))*) </code></pre> <p>should do it nicely.<br> (Note: <code>(?ms)</code> is the way in Java to specify a "multi-line" "dot-all" mode, but I have <a href="http://regexlib.com/RETester.aspx" rel="nofollow noreferrer">tested in on RETester</a> and it works)</p> <p>It can detect 0 or more comments after the <code>select</code>.<br> Multi line comments are accepted between <code>/*</code> and <code>*/</code> because of the use of a <a href="http://www.regular-expressions.info/lookaround.html" rel="nofollow noreferrer">positive lookahead</a> <code>(?:.(?!\*/))+</code> in a non-capturing group</p> <p>Update: modified it to detect any "non-comment" line before 0 or many comments.</p> <hr> <p>To detect comment1, then statement, then comments:</p> <pre><code>(?ms)((?:(?:\s+/\*(?:.(?!\*/))+.\*/)|(?:\s+\-\-[^\r\n]+))*)\s*^\s*([^\-/\s][^;]+;)((?:(?:\s+/\*(?:.(?!\*/))+.\*/)|(?:\s+\-\-[^\r\n]+))*) </code></pre> <p>Note: I have update in both regexps (the one in the beginning and this one) the statement detection part:</p> <pre><code>\s*([^\-/][^;]+;) </code></pre> <p>to </p> <pre><code>\s*([^\-/\s][^;]+;) </code></pre> <p>Note bis: only the first "<code>comments - statement - comments</code>" will be detected.<br> The next blocks will also be detected, but only as : "<code>statement - comments</code>", then "<code>statement - comments</code>", and so on. (the comments above a statement are part of the comments <em>below</em> the <em>previous</em> statement)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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