Extract all characters between _ and .csv
<p>I am trying to extract the date from a series of files of the form:</p>

<p><code>costs_per_day_100516.csv</code></p>

<p>I have gotten to the point of extracting the <code>6</code>, but I don't understand why I can't extract more. What is wrong with the following:</p>

<pre><code>test_string = 'search_adwords_cost_by_state_100516.csv'
m = re.search("_([^_])*\.csv", test_string)
m.group(1)
</code></pre>

<p>This yields <code>6</code> rather than <code>100516</code>. What am I doing wrong?</p>

<pre><code>Data_Frame_Name.join(filter(lambda x: x.isdigit(), Data_Frame_Name['Column_Name']))
</code></pre>

<p>This will extract just digits. This may not be applicable for your case but would work well for extracting digits from multiple rows in a column.</p>

python regex