title: How would I extract numbers from column names based on a match condition in spark scala?
body: <p>I have a dataframe like this,</p>
  <pre><code>  val df = Seq((12,14,56,22,18),(11,54,83,91,12)).toDF(&quot;individual_rule_1_professional&quot;,
  &quot;individual_rule_2_amateur&quot;,&quot;team_rule_3_professional&quot;,&quot;team_rule_4_amateur&quot;,&quot;total&quot;)
  </code></pre>
  <p>and I would like to extract the rule numbers of columns that start with individual and end with amateur into an array. So in this case it would return [2], because there's only one column in the dataframe that starts with individual and ends with amateur, and the rule number for that column is 2.</p>
  <p>How would I do this?</p>
  <p>Thanks so much! Have a great day.</p>