[PHP] Regex nightmares

2005-05-23 Thread W Luke
Hi, I really struggle with regex, and would appreciate some guidance. Basically, I have a whole load of files (HTML) which are updated every few minutes. I need to go through each line, looking for the word CONFIRMED: (which is always in capitals, and always superseded by a colon). The line

[PHP] Replacing 2 strings

2005-05-29 Thread W Luke
Hi, I have some text in a file which, when it's dumped to a var, needs to be replaced. In its raw form, it looks like this: ^JIM_JONES and I need to remove the ^_ and characters and have it read Jim-Jones It's nestled in amongst a load of other text - I'm fopen'ing a file and reading it line

Re: [PHP] Replacing 2 strings

2005-05-30 Thread W Luke
On 30/05/05, Brian V Bonini [EMAIL PROTECTED] wrote: On Sun, 2005-05-29 at 12:22, W Luke wrote: Hi, I have some text in a file which, when it's dumped to a var, needs to be replaced. In its raw form, it looks like this: ^JIM_JONES and I need to remove the ^_ and characters and have

Re: [PHP] Replacing 2 strings

2005-05-30 Thread W Luke
On 30/05/05, Brian V Bonini [EMAIL PROTECTED] wrote: On Mon, 2005-05-30 at 11:13, Murray @ PlanetThoughtful wrote: Someone much more clever that I can probably come up with something much cleaner and efficient but This works... Definitely not more clever and arguably not more

Re: [PHP] Replacing 2 strings

2005-05-30 Thread W Luke
On 30/05/05, Brian V Bonini [EMAIL PROTECTED] wrote: [...] Again, an example that is as close to your real-world needs as possible would be very helpful. The original request was: the text-to-replace is just in a var named $text1. I read that to mean you'd already extracted ^JIM_JONES

Re: [PHP] Replacing 2 strings

2005-05-31 Thread W Luke
On 31/05/05, Murray @ PlanetThoughtful [EMAIL PROTECTED] wrote: ? function replace($string){ preg_match(/^\^([a-zA-Z]+?)_([a-zA-Z]+?)/, $string, $matcharr); $string = str_replace($matcharr[0], $matcharr[1] . .$matcharr[2] . :, $string); return $string; }

Re: [PHP] Replacing 2 strings

2005-06-01 Thread W Luke
On 31/05/05, W Luke [EMAIL PROTECTED] wrote: On 31/05/05, Murray @ PlanetThoughtful [EMAIL PROTECTED] wrote: ? function replace($string){ preg_match(/^\^([a-zA-Z]+?)_([a-zA-Z]+?)/, $string, $matcharr); $string = str_replace($matcharr[0], $matcharr[1] . .$matcharr[2

[PHP] Group By problems

2005-07-03 Thread W Luke
Hi, I used to have problems with this in Cold Fusion - and I'm still struggling this time in PHP! Very basic. Looping over 2 tables - an email table, and a data-table. I'm using * just for ease for the time being: SELECT * FROM f_c_users,f_comments WHERE fcEmail=cemail GROUP by fcEmail If

[PHP] Using SELECT IN with arrays

2005-02-02 Thread W Luke
Hi. I'm trying to execute a query which does a SELECT IN on an array...here's how it stands: $doms = implode( ',', $domarray ); $d=$_GET['d'] $qmailsql = SELECT mq.id, mq.user, mq.domain, mq.sender, mq.arrive_time, mq.subject, mq.body_preview, mq.relay FROM mail_quarantine AS mq WHERE //??

Re: [PHP] Using SELECT IN with arrays

2005-02-02 Thread W Luke
On Thu, 3 Feb 2005 08:37:44 +0800, Jason Wong [EMAIL PROTECTED] wrote: $doms is a master array of a user's domains. $d is a comma-seperated and unexploded list of domains to filter the SELECT down with. (error checking is already in place) 1) make both $d and $doms into array 2) use

[PHP] Escaping using htmlentities

2005-02-03 Thread W Luke
Hi. htmlentities has worked pretty well so far for me...except when it comes across something like ñw or ñ0w in an RSS feed (v2) It tries to convert the ntilde - and it does, but because the ñ doesn't have a space next to the w or the 0w, it breaks the XML and it comes out as ntilde;0w which, I

Re: [PHP] newbie question regarding forms and drop down list

2005-02-03 Thread W Luke
On Thu, 3 Feb 2005 15:45:51 -0800, Max Krone [EMAIL PROTECTED] wrote: I assume I am just missing something dumb. Could someone please enlighten me. I can post my code if it will help. Code please, Max! -- Will The Corridor of Uncertainty http://www.cricket.mailliw.com/ - Sanity is a

[PHP] Weighted Lists

2005-02-09 Thread W Luke
Hi, I've been fascinated by Flickr's, del.icio.us and other sites' usage of these Weighted Lists. It's simple but effective and I really want to use it for a project I'm doing. So I had a look at Nick Olejniczak's plugin for Wordpress (available here: www.nicholasjon.com) but am struggling to

Re: [PHP] Re: Weighted Lists

2005-02-10 Thread W Luke
On Wed, 09 Feb 2005 10:56:51 -0800 (PST), Matthew Weier O'Phinney [EMAIL PROTECTED] wrote: * W Luke [EMAIL PROTECTED]: I've been fascinated by Flickr's, del.icio.us and other sites' usage of these Weighted Lists. It's simple but effective and I really want to use it for a project I'm doing

[PHP] Replacing spaces with commas

2005-04-17 Thread W Luke
Hi, I have about 200 records in a table, and I need to update 2 of the fields. The first is easy, but the second contains a list of keywords all separated by spaces; I need to replace the spaces with commas. Is this something I can do with some clever SQL, or shall I just do it in PHP? Any

Re: [PHP] Replacing spaces with commas

2005-04-17 Thread W Luke
On 4/17/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have about 200 records in a table, and I need to update 2 of the fields. The first is easy, but the second contains a list of keywords all separated by spaces; I need to replace the spaces with commas. Is this something I can do