Regex to match repeated set of characters
<p>I'd like to be able to extract the following patterns from free text.</p>

<pre><code>VBAV/123456.01
VBAV/132453.02
VSAV/132452.01.03
VMAV/142143.01.02
</code></pre>

<p>Currently I am trying as below but not much success</p>

<pre><code>df["Project Id"] = df["WBS element"].str.cat(
df["Network VxAV"]).str.cat(
df["Text"]).str.cat(
df["Assignment"]).str.cat(
df["Reference"]).str.extract(
"(V[BSM]AV\/[\d]{6}[.0-30-3]{0,2})", expand=True)
</code></pre>

<p>The challenging part for me was to extract the patterns of repeated .01 or .02 or .03 at the end. This part can repeat between 0 to 2 times, hence my attempt with {0,2} with the regex.</p>

<p>What would be the right regex for this? </p>

<pre><code>r'V[BSM]AV/\d{6}(?:\.\d\d){0,2}(?!\d)'
</code></pre>

<p>Matches exactly 6 digits, and 0-2 instances of <code>.##</code>. <code>(?:xxxx)</code> is a non-capturing group.  Cannot be followed by another digit, so it won't match:</p>

<pre><code>VBAV\1234567
VBAV\122346.123
</code></pre>

<p>You may need to adjust what can't follow the match.</p>

python regex pandas