PHP - Moved: Preg_match Assistance
This topic has been moved to PHP Regex.
http://www.phpfreaks.com/forums/index.php?topic=348975.0 Similar TutorialsI'm trying to dissect a string using preg_match but I'm having a hard time understanding the tutorials (and the php manual). This is as far as I've gotten: Code: [Select] <?php $message = "EASTRIVANN RES STRUCTURE FIRE AD: 4966 TURKEY SAG RD CTY: AC LOC: ATAC4 FIRE IN STRUCTURE/ALARM CO CONFIRMED W/HOMEOWNER XST: 2751 BELL ACRES XST2: 2312 PETERS MTN RD"; $typepattern = ('/^EASTRIVANN /'); preg_match($typepattern, $message, $matches); if ($matches) { echo $matches[0]; }else{ echo 'No matches.'; } ?> My goal is to pull the following out of the string: Code: [Select] $alarmtype = "RES STRUCTURE FIRE"; $address = "4966 TURKEY SAG RD"; $county = "AC"; $location = "ATAC4 FIRE IN STRUCTURE/ALARM CO CONFIRMED W/HOMEOWNER"; $xst = "2751 BELL ACRES"; $xst2 = "2312 PETERS MTN RD"; I am them storing the values into a database for later retrieval. I've gotten as far as Matching EASTRIVANN but i'm not sure how to pull out the actual text between my anchors. Any help would greatly be appreciated Thanks Jason This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=355835.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=323604.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=320132.0 This topic has been... uh... whatsit... moved? to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=353911.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=331694.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=318058.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=357263.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=318181.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=314652.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=317682.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=329322.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=329803.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=315924.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=317962.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=320413.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=327702.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=345873.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=345218.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=315198.0 |