title: php regex matching first and last
body: <p>i'm new to regular expressions and would like to match the first and last occurrences of a term in php. for instance in this line:</p>
  
  <p>"charlie, mary,bob,bob,mary, charlie, charlie, mary,bob,bob,mary,charlie"</p>
  
  <p>i would like to just access the first and last "charlie", but not the two in the middle. how would i just match on the first and last occurrence of a term? </p>
  
  <p>thanks</p>