<?php
$regex = '~
(?P<address>[^,]+),\h+ # everything that is not a comma, followed by a comma and horizontal whitespace
(?P<city>[^,]+),\h+ # the same as above
(?P<state_zip>[^\n]+) # everything but a newline
~x'; # verbose mode
$string = '555 Test Drive, Testville, CA 98773';
echo $match["address"];
?>
PD9waHAKJHJlZ2V4ID0gJ34KICAgICAgICAgICAoP1A8YWRkcmVzcz5bXixdKyksXGgrICMgZXZlcnl0aGluZyB0aGF0IGlzIG5vdCBhIGNvbW1hLCBmb2xsb3dlZCBieSBhIGNvbW1hIGFuZCBob3Jpem9udGFsIHdoaXRlc3BhY2UKICAgICAgICAgICAoP1A8Y2l0eT5bXixdKyksXGgrICAgICMgdGhlIHNhbWUgYXMgYWJvdmUgCiAgICAgICAgICAgKD9QPHN0YXRlX3ppcD5bXlxuXSspICAjIGV2ZXJ5dGhpbmcgYnV0IGEgbmV3bGluZQogICAgICAgICAgfngnOyAgICAgICAgICAgICAgICAgICAgIyB2ZXJib3NlIG1vZGUKJHN0cmluZyA9ICc1NTUgVGVzdCBEcml2ZSwgVGVzdHZpbGxlLCBDQSA5ODc3Myc7CnByZWdfbWF0Y2goJHJlZ2V4LCAkc3RyaW5nLCAkbWF0Y2gpOwplY2hvICRtYXRjaFsiYWRkcmVzcyJdOwo/Pg==