title: Count the number of words in the line beginning with a particular word
body: <p>I want to count the number of words in a particular line which contains a specific ID (e.g. *AUY). So far I have tried using the below regex for finding the line but it does not consider the "*" at the start </p>
  
  <pre><code>^ *(.*\b(?:\\*AUY)\b.*) *$
  </code></pre>
  
  <p>I have below test string </p>
  
  <pre><code>*AUY:   today is holiday so Peter and Mary do not need to go to work .
  %mor:   n|today cop|be&amp;3s n|holiday conj|so n:prop|Peter conj|and n:prop|Mary v|do neg|not v|need inf|to v|go prep|to n|work .
  %snd:   &lt;00:00:00&gt;&lt;00:07:37&gt;
  %AUY:   ok_pfp (0.40) er today is holiday errfr ::: so er Peter and Mary {is} ~ er do not need errfr ::: to go to work . errfr :;:a |
  </code></pre>
  
  <p>The result should be only first string but it returns first and last string in result matches.
  See this <a href="http://rubular.com/r/WxQAKkiaXj" rel="nofollow noreferrer">Rubular</a></p>