Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I can give you a pattern that would work with Ruby (sorry, I haven't used C# for a while). This pattern will capture the numbers, if used with the <code>scan</code> function. I'm sure there will be something you can do with captures and groups in C# that is similar:</p> <pre class="lang-rb prettyprint-override"><code>pattern = /^\s*( [\-\+]? [0-9]+ ) ( (\s+ [\-\+]? [0-9]+ ) )*$/x xs = ["9", "+9", "-9", "87", "+87", "-87", "9 87", "9 +87", "9 -87", "+9 87", "-9 87", "+9 +87", "-9 +87", "-9 87", "9 +9 -9", "9 +9 87", "9 +9 +87", "9 +9 -87", "9 +9 654", "9 +9 +654", "9 +9 -654", "9 -9 87", "9 -9 +87", "9 -9 -87", "9 -9 654", "9 -9 +654", "9 -9 -654", "9 87 +87", "9 87 -87", "9 87 654", "9 87 +654", "9 87 -654", "9 +87 -87", "9 +87 654", "9 +87 +654", "9 +87 -654", "9 -87 654", "9 -87 +654", "9 -87 -654", "9 654 +654", "9 654 -654", "9 +654 -654", "+9 -9 87", "+9 -9 +87", "+9 -9 -87", "+9 -9 654", "+9 -9 +654", "+9 -9 -654", "+9 87 +87", "+9 87 -87", "+9 87 654", "+9 87 +654", "+9 87 -654", "+9 +87 -87", "+9 +87 654", "+9 +87 +654", "+9 +87 -654", "+9 -87 654", "+9 -87 +654", "+9 -87 -654", "+9 654 +654", "+9 654 -654", "+9 +654 -654", "-9 87 +87", "-9 87 -87", "-9 87 654", "-9 87 +654", "-9 87 -654", "-9 +87 -87", "-9 +87 654", "-9 +87 +654", "-9 +87 -654", "-9 -87 654", "-9 -87 +654", "-9 -87 -654", "-9 654 +654", "-9 654 -654", "-9 +654 -654", " 87 +87 -87", " 87 +87 654", " 87 +87 +654", " 87 +87 -654", " 87 -87 654", " 87 -87 +654", " 87 -87 -654", " 87 654 +654", " 87 654 -654", " 87 +654 -654", " +87 -87 654", " +87 -87 +654", " +87 -87 -654", " +87 654 +654", " +87 654 -654", " +87 +654 -654", " -87 654 +654", " -87 654 -654", " -87 +654 -654", "654 +654 -654"] xs.each{|x| printf("%15s: %s\n", x, x.scan(pattern).inspect) } </code></pre> <p>Results in:</p> <pre><code> 9: ["9"] +9: ["+9"] -9: ["-9"] 87: ["87"] +87: ["+87"] -87: ["-87"] 9 87: ["9", "87"] 9 +87: ["9", "+87"] 9 -87: ["9", "-87"] +9 87: ["+9", "87"] -9 87: ["-9", "87"] +9 +87: ["+9", "+87"] -9 +87: ["-9", "+87"] -9 87: ["-9", "87"] 9 +9 -9: ["9", "+9", "-9"] 9 +9 87: ["9", "+9", "87"] 9 +9 +87: ["9", "+9", "+87"] 9 +9 -87: ["9", "+9", "-87"] 9 +9 654: ["9", "+9", "654"] 9 +9 +654: ["9", "+9", "+654"] 9 +9 -654: ["9", "+9", "-654"] 9 -9 87: ["9", "-9", "87"] 9 -9 +87: ["9", "-9", "+87"] 9 -9 -87: ["9", "-9", "-87"] 9 -9 654: ["9", "-9", "654"] 9 -9 +654: ["9", "-9", "+654"] 9 -9 -654: ["9", "-9", "-654"] 9 87 +87: ["9", "87", "+87"] 9 87 -87: ["9", "87", "-87"] 9 87 654: ["9", "87", "654"] 9 87 +654: ["9", "87", "+654"] 9 87 -654: ["9", "87", "-654"] 9 +87 -87: ["9", "+87", "-87"] 9 +87 654: ["9", "+87", "654"] 9 +87 +654: ["9", "+87", "+654"] 9 +87 -654: ["9", "+87", "-654"] 9 -87 654: ["9", "-87", "654"] 9 -87 +654: ["9", "-87", "+654"] 9 -87 -654: ["9", "-87", "-654"] 9 654 +654: ["9", "654", "+654"] 9 654 -654: ["9", "654", "-654"] 9 +654 -654: ["9", "+654", "-654"] +9 -9 87: ["+9", "-9", "87"] +9 -9 +87: ["+9", "-9", "+87"] +9 -9 -87: ["+9", "-9", "-87"] +9 -9 654: ["+9", "-9", "654"] +9 -9 +654: ["+9", "-9", "+654"] +9 -9 -654: ["+9", "-9", "-654"] +9 87 +87: ["+9", "87", "+87"] +9 87 -87: ["+9", "87", "-87"] +9 87 654: ["+9", "87", "654"] +9 87 +654: ["+9", "87", "+654"] +9 87 -654: ["+9", "87", "-654"] +9 +87 -87: ["+9", "+87", "-87"] +9 +87 654: ["+9", "+87", "654"] +9 +87 +654: ["+9", "+87", "+654"] +9 +87 -654: ["+9", "+87", "-654"] +9 -87 654: ["+9", "-87", "654"] +9 -87 +654: ["+9", "-87", "+654"] +9 -87 -654: ["+9", "-87", "-654"] +9 654 +654: ["+9", "654", "+654"] +9 654 -654: ["+9", "654", "-654"] +9 +654 -654: ["+9", "+654", "-654"] -9 87 +87: ["-9", "87", "+87"] -9 87 -87: ["-9", "87", "-87"] -9 87 654: ["-9", "87", "654"] -9 87 +654: ["-9", "87", "+654"] -9 87 -654: ["-9", "87", "-654"] -9 +87 -87: ["-9", "+87", "-87"] -9 +87 654: ["-9", "+87", "654"] -9 +87 +654: ["-9", "+87", "+654"] -9 +87 -654: ["-9", "+87", "-654"] -9 -87 654: ["-9", "-87", "654"] -9 -87 +654: ["-9", "-87", "+654"] -9 -87 -654: ["-9", "-87", "-654"] -9 654 +654: ["-9", "654", "+654"] -9 654 -654: ["-9", "654", "-654"] -9 +654 -654: ["-9", "+654", "-654"] 87 +87 -87: ["87", "+87", "-87"] 87 +87 654: ["87", "+87", "654"] 87 +87 +654: ["87", "+87", "+654"] 87 +87 -654: ["87", "+87", "-654"] 87 -87 654: ["87", "-87", "654"] 87 -87 +654: ["87", "-87", "+654"] 87 -87 -654: ["87", "-87", "-654"] 87 654 +654: ["87", "654", "+654"] 87 654 -654: ["87", "654", "-654"] 87 +654 -654: ["87", "+654", "-654"] +87 -87 654: ["+87", "-87", "654"] +87 -87 +654: ["+87", "-87", "+654"] +87 -87 -654: ["+87", "-87", "-654"] +87 654 +654: ["+87", "654", "+654"] +87 654 -654: ["+87", "654", "-654"] +87 +654 -654: ["+87", "+654", "-654"] -87 654 +654: ["-87", "654", "+654"] -87 654 -654: ["-87", "654", "-654"] -87 +654 -654: ["-87", "+654", "-654"] 654 +654 -654: ["654", "+654", "-654"] </code></pre>
    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.
    3. 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