Re: [PHP] Parse question
On Jan 21, 2011, at 7:52 PM, Ron Piggott wrote: Would someone write me a syntax so all the web site addresses in $data turn into links $data = “Visit our web site http://www.site.com, http://www.secondsite.org and http://www.thirdsite.info.”; My desired results for what I am asking for help turn $data into: $output =“Visit our web site a href=”http://www.site.com”http://www.site.com/a, a href=”http://www.secondsite.org”http://www.secondsite.org/a and a href=”http://www.thirdsite.info”http://www.thirdsite.info/a.”; Please make provision for .net web sites as well. Ron I would check for url regex patterns and build a solution off of that. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
Re: [PHP] Parse question
On Jan 21, 2011, at 6:52 PM, Ron Piggott wrote: Would someone write me a syntax so all the web site addresses in $data turn into links $data = “Visit our web site http://www.site.com, http://www.secondsite.org and http://www.thirdsite.info.”; My desired results for what I am asking for help turn $data into: $output =“Visit our web site a href=”http://www.site.com”http://www.site.com/a, a href=”http://www.secondsite.org”http://www.secondsite.org/a and a href=”http://www.thirdsite.info”http://www.thirdsite.info/a.”; Please make provision for .net web sites as well. Ron The Verse of the Day “Encouragement from God’s Word” http://www.TheVerseOfTheDay.info Would someone write me a syntax hummm... If you need help, we can do that, but if you want someone to write it for you, go here: http://www.google.com/#sclient=psyhl=ensite=source=hpq=hire+freelance+PHP+web+developeraq=faqi=aql=oq=pbx=1fp=d87fcfdb2e6b7745
Re: [PHP] Parse question
On Jan 21, 2011, at 6:52 PM, Ron Piggott wrote: Would someone write me a syntax so all the web site addresses in $data turn into links $data = “Visit our web site http://www.site.com, http://www.secondsite.org and http://www.thirdsite.info.”; My desired results for what I am asking for help turn $data into: $output =“Visit our web site a href=”http://www.site.com”http://www.site.com/a, a href=”http://www.secondsite.org”http://www.secondsite.org/a and a href=”http://www.thirdsite.info”http://www.thirdsite.info/a.”; Please make provision for .net web sites as well. Ron The Verse of the Day “Encouragement from God’s Word” http://www.TheVerseOfTheDay.info Would someone write me a syntax hummm... If you need help, we can do that, but if you want someone to write it for you, go here: http://www.google.com/#sclient=psyhl=ensite=source=hpq=hire+freelance+PHP+web+developeraq=faqi=aql=oq=pbx=1fp=d87fcfdb2e6b7745 === Now that I have seen some examples I will work on this and may ask a specific question tomorrow. I know how to program in PHP --- I am just not strong in the string manipulation commands. Thanks for these valuable links. Ron
Re: [PHP] Parse question
Check this out. http://www.regular-expressions.info/email.html --- “Talk is cheap. Show me the code” - Linus Torvalds On Thu, May 13, 2010 at 7:34 AM, Ron Piggott ron.pigg...@actsministries.org wrote: If $message_body contains: $message_body=You are subscribed using u...@domain. To update; How do I capture just the e-mail address? Ron
RE: [PHP] Parse question
-Original Message- From: Ron Piggott [mailto:ron.pigg...@actsministries.org] Sent: 13 May 2010 06:34 AM To: PHP General Subject: [PHP] Parse question If $message_body contains: $message_body=You are subscribed using u...@domain. To update; How do I capture just the e-mail address? Ron __ Regular Expressions ... They're great at this sort of thing! I'd suggest starting here: http://www.regular-expressions.info/email.html Then take a look at the PHP regular expression manual: http://www.php.net/manual/en/book.pcre.php Have fun! Lawrance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Question Using list()
Use the tool that PHP provides for such problems. http://php.net/fgetcsv fgetcsv is very useful, here a example: ?php $row = 1; /* load file*/ $handle = fopen(log.csv, r); /* read line by line */ while (($data = fgetcsv($handle, 1000, ,)) !== FALSE) { $num = count($data); echo p $num fields in line $row: br //p\n; $row++; for ($c=0; $c $num; $c++) { echo $data[$c] . br /\n; } } fclose($handle); ? -- Gerardo Benitez
Re: [PHP] Parse Question Using list()
$line = fgets($handle); list($col1, $col2, $col3) = $line; [8] echo c1 is $col1 and c2 is $col2 and c3 is $col3.'br'; // this shows just 1st char of each field That's odd, I would have expected $col1, $col2, and $col3 to be NULL. That's what I get when I try to assign a string to list(). It expects a PHP array. You could tackle this in a couple of different ways. Either split your string into an array first: $line = fgets($handle); $columns = explode(,, trim($line)); list($col1,$col2,$col3) = $columns; Or look at using fgetcsv(), which will save you a step or two: http://php.net/manual/en/function.fgetcsv.php Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Question Using list()
On Oct 1, 2009, at 5:02 PM, Ben Dunlap wrote: You could tackle this in a couple of different ways. Either split your string into an array first: $line = fgets($handle); $columns = explode(,, trim($line)); Thanks Ben - the explode() command worked great! - Now a bit of another problem I'm exporting from another database (mac) to a csv file then a quick import to excel 2004 (mac) for some cleaning... before the excel import, some date fields look like 2009-9-29 11:21:37 = good for sql import but excel does an auto reformat to 9/29/2009 11:21:37 AM = not good for sql import Q: any way to turn this auto reformat off in excel and keep it the way I had it? (I saw nothing in pref's) Thanks, c...@hosting4days.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Question Using list()
c...@hosting4days.com wrote: On Oct 1, 2009, at 5:02 PM, Ben Dunlap wrote: You could tackle this in a couple of different ways. Either split your string into an array first: $line = fgets($handle); $columns = explode(,, trim($line)); Thanks Ben - the explode() command worked great! Use the tool that PHP provides for such problems. http://php.net/fgetcsv - Now a bit of another problem I'm exporting from another database (mac) to a csv file then a quick import to excel 2004 (mac) for some cleaning... before the excel import, some date fields look like 2009-9-29 11:21:37 = good for sql import but excel does an auto reformat to 9/29/2009 11:21:37 AM = not good for sql import Q: any way to turn this auto reformat off in excel and keep it the way I had it? (I saw nothing in pref's) try using strtotime() on that field and see if it works. http://php.net/strtotime I'm pretty sure that function will handle it. Thanks, c...@hosting4days.com -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php