Satanas Posted August 3, 2008 Share Posted August 3, 2008 Hello PHP Freaks! I need a little help... I have a page with Latitude and Longitude coordinates and they are separeted with a blank space. How can I read them with a RegEx ? I put in bold what I want to get... Here is the format of the line: LPPT 0 0 N38°46'27.00" W009°08'03.00" LISBOA Tks! Quote Link to comment https://forums.phpfreaks.com/topic/117964-regex-help/ Share on other sites More sharing options...
MadTechie Posted August 3, 2008 Share Posted August 3, 2008 try this <?PHP $str = 'LPPT 0 0 N38°46'27.00" W009°08'03.00" LISBOA'; preg_match_all('/\s([^\s]*?")/si', $str, $result, PREG_PATTERN_ORDER); $result = $result[1]; $Latitude = $result[0]; $Longitude = $result[1]; echo "Latitude = $Latitude <BR>Longitude = $Longitude"; ?> *untested* Quote Link to comment https://forums.phpfreaks.com/topic/117964-regex-help/#findComment-606852 Share on other sites More sharing options...
Satanas Posted August 3, 2008 Author Share Posted August 3, 2008 Excelent! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/117964-regex-help/#findComment-606956 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.