Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regular Expressions

Status
Not open for further replies.
Jun 18, 2003
6
US
Given the string below, it parses all the information i want correctly. However, after the FIPS Code (40035) there could be any number of characters, numbers, spaces, etc. How could i change the regular expression to allow all after the 40035 and put it into a single part of the array?

<?php

$string = 'FIPSCodeVinitaOK74301Craig40035';

preg_match_all ('/^(FIPSCode)([a-z]*)([a-z]{2})(\d{5})([a-z]*)(\d*)$/i', $string, $data_array);

print_r ($data_array);
print &quot;\n&quot;;
?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top