Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your regex runs into <a href="http://www.regular-expressions.info/catastrophic.html" rel="noreferrer">catastrophic backtracking</a> because you have nested quantifiers (<code>([...]+)*</code>). Since your regex requires the string to end in <code>/</code> (which fails on your example), the regex engine tries all permutations of the string in the vain hope to find a matching combination. That's where it gets stuck.</p> <p>To illustrate, let's assume <code>"A*BCD"</code> as the input to your regex and see what happens:</p> <ol> <li><code>(\w+)</code> matches <code>A</code>. Good.</li> <li><code>\*</code> matches <code>*</code>. Yay.</li> <li><code>[\w\s]+</code> matches <code>BCD</code>. OK.</li> <li><code>/</code> fails to match (no characters left to match). OK, let's back up one character.</li> <li><code>/</code> fails to match <code>D</code>. Hum. Let's back up some more.</li> <li><code>[\w\s]+</code> matches <code>BC</code>, and the repeated <code>[\w\s]+</code> matches <code>D</code>. </li> <li><code>/</code> fails to match. Back up.</li> <li><code>/</code> fails to match <code>D</code>. Back up some more.</li> <li><code>[\w\s]+</code> matches <code>B</code>, and the repeated <code>[\w\s]+</code> matches <code>CD</code>. </li> <li><code>/</code> fails to match. Back up again.</li> <li><code>/</code> fails to match <code>D</code>. Back up some more, again.</li> <li>How about <code>[\w\s]+</code> matches <code>B</code>, repeated <code>[\w\s]+</code> matches <code>C</code>, repeated <code>[\w\s]+</code> matches <code>D</code>? No? Let's try something else.</li> <li><code>[\w\s]+</code> matches <code>BC</code>. Let's stop here and see what happens.</li> <li>Darn, <code>/</code> still doesn't match <code>D</code>.</li> <li><code>[\w\s]+</code> matches <code>B</code>.</li> <li>Still no luck. <code>/</code> doesn't match <code>C</code>.</li> <li>Hey, the whole group is optional <code>(...)*</code>.</li> <li>Nope, <code>/</code> still doesn't match <code>B</code>.</li> <li>OK, I give up.</li> </ol> <p>Now that was a string of just three letters. Yours had about 30, trying all permutations of which would keep your computer busy until the end of days.</p> <p>I suppose what you're trying to do is to get the strings before/after <code>*</code>, in which case, use</p> <pre><code>pattern = r"(\w+)\*([\w\s]+)$" </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