Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>well, the individual regexs break down into this:</p> <p>Index: Capture a single positive or negative number. (-, 0 or 1 rep, followed by one or more digits)</p> <p>date: Specified date string, separated with -. No allowance made for any other date format. Note, the leading '#' and trailing '#' are not handled, it specifically captures the date, and only the date</p> <p>R: beginning of line OR #, then the formatting replacement to make it one BIG regex...then another #, specified. then a conditional with no false...and true doesn't do anything either.</p> <p>name: capture whatever is left.</p> <p>final result, compiled into a single regex.... two captures: R and name. R: (4 parts) R-1: Match either beginning of line or # R-2: Get EITHER (but never both) Date or Index R-3: match # R-4: Empty Conditional Expression name: match whatever is left.</p> <p>The issue seems to be that you are not matching both index and date</p> <p><strong>final edit, working regex</strong></p> <p>Bear with me, this thing is nasty. You have to account for all 4 possibilities, or it wont match every possible case. I couldn't figure out any way to generalize it.</p> <pre><code>(?:(?&lt;index&gt;-?\d+(?!\d-))#(?&lt;date&gt;(?:0?[1-9]|1[012])-(?:0?[1-9]|[12]\d|:3[01])-\d{4})|(?&lt;date&gt;(?:0?[1-9]|1[012])-(?:0?[1-9]|[12]\d|:3[01])-\d{4})#(?&lt;index&gt;-?\d+)|(?!-?\d+#)(?&lt;date&gt;(?:0?[1-9]|1[012])-(?:0?[1-9]|[12]\d|:3[01])-\d{4})|(?&lt;index&gt;-?\d+)(?!#(?:0?[1-9]|1[012])-(?:0?[1-9]|[12]\d|:3[01])-\d{4}))#(?&lt;name&gt;.*) </code></pre> <p>ugly, i know. It has 4 initial conditions.</p> <pre><code>1a) capture &lt;index&gt;#&lt;date&gt; OR 1b) capture &lt;date&gt;#&lt;index&gt; OR 1c) capture &lt;index&gt; only, as long as its not followed by a date OR 1d) capture &lt;date&gt; only, as long as its not preceded by an index ... 2) match but ignore # 3) capture &lt;name&gt; </code></pre> <p>works in all 4 cases.</p> <p><strong>Final: Final Edit</strong></p> <p>There is a way to do this using 3 regexs instead of just 1, which might end up being cleaner.</p> <pre><code>//note: index MIGHT be preceeded by, and is ALWAYS followed by, a # indexRegex = @"((?=#)?(?&lt;!\d|-)-?\d+(?=#))"; //same with date dateRegex = @"((?=#)?(?:0?[1-9]|1[012])-(?:0?[1-9]|[12]\d|3[01])-\d{4}(?=#))"; //then name nameRegex = @"(?:.*#){1,2}(.*)"; </code></pre> <p>run them each separately against a replace to get the individual variables, then rebuild the string.</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