Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this expression: <code>(?&gt;-?\d+(?:[\./]\d+)?)</code>, keep in mind that in Java strings you need to escape the backslashes, i.e. you'd get <code>"(?&gt;-?\\d+(?:[\\./]\\d+)?)"</code> </p> <p>Here's a breakdown of the expression:</p> <ol> <li><p>The encloseing <code>(?&gt;...)</code> is an atomic group to prevent catastrophic backtracking. For simple or short strings it would work without as well.</p></li> <li><p><code>-?</code> a potential minus for negative numbers </p></li> <li><p><code>\d+</code> any sequence of digits (at least one)</p></li> <li><p><code>(?:[\./]\d+)?</code> an optional non-capturing group consisting of either a dot (note that you don't need to escape it here, it's just for consistency) or a slash followed by at least one more digit.</p></li> </ol> <p><em>Update</em></p> <p>If you don't want to replace "numbers" like <code>.1234</code>, <code>1234.</code> <code>/1</code> or <code>5/</code> (a digit is missing either left or right), try this expression: <code>(?&gt;(?&lt;![\d\./])-?\d+(?:(?:[\./]\d+)|(?![\d\./])))</code></p> <p>Here's a breakdown again:</p> <ol> <li><p>The encloseing <code>(?&gt;...)</code> is an atomic group to prevent catastrophic backtracking. For simple or short strings it would work without as well.</p></li> <li><p><code>(?&lt;![\d\./])</code> the match must not directly follow a digit, dot or slash - note that the not follow a digit constraint is needed to match at the start of the number, otherwise you'd match <code>234</code> in <code>.1234</code></p></li> <li><p><code>-?</code> a potential minus for negative numbers </p></li> <li><p><code>\\d+</code> any sequence of digits (at least one)</p></li> <li><p><code>(?:(?:[\./]\d+)|(?![\d\./]))</code> the match must either have a dot or slash followed by at least one digit or must not be followed by a digit, dot or slash, this would match <code>1.0</code> but not <code>1.</code> - note that the not to be followed by a digit constraint is needed to prevent matching <code>123</code> in <code>1234.</code></p></li> </ol>
    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