NYCPHP Meetup

NYPHP.org

[nycphp-talk] quick regex question

Hans Zaunere hans at nyphp.org
Thu Sep 4 10:01:51 EDT 2003


Given:
 
$swipe = 'A405E,;095612813=1227?2003/08/20 10:51:15 4A4';

preg_match('/\;(.+)\=/s',$swipe,$match);

This fills $match as:

array(2) {
  [0]=>
  string(11) ";095612813="
  [1]=>
  string(9) "095612813"
}


Can I modify my subpattern somehow, so that only the second element of the array is returned?  I don't need the whole string, just the matched pattern itself (ie, I don't need the ';' and '=' chars in the result).

Hopefully I can get my work done and give my take on the fundamentals!  Thanks,

H




More information about the talk mailing list