regex match space forward slash and space ' / '
<p>Here is my string 'something / something else'
I would like to match with regex everything up to <code>/</code> i.e space forward slash space again. Here is what I tried =<code>/.+?(?=\s//\s)/</code>, but it does not work. It says: 'pattern contains no capture groups'. I am using it with pandas extract function.</p>

<p>Not sure if I understand your requirements exactly, but this should do the trick:</p>

<pre><code>(.*?)(?= \/ )
</code></pre>

<p><a href="https://regex101.com/r/JJYyg0/1" rel="nofollow">Try it here</a></p>

<p>You can replace the <code>*</code> with a <code>+</code> if there must be at least one character before <code>/</code>.</p>

<p>The problem with your code is that <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.str.extract.html" rel="nofollow"><code>pd.Series.str.extract</code></a> expects a "regular expression pattern <strong>with capturing groups</strong>." Your regex includes a positive lookahead (<code>?=</code>) but does not have a captured group (something between parentheses). If you surround <code>.+?</code> with parentheses in your example, it should work, but note that <code>\s</code> captures <em>any</em> whitespace, not just spaces.</p>

python regex pandas