Re: [PHP] ereg help!

2008-01-09 Thread Richard Heyes
$out = basename($file, ".html") . ".com"; fairly limited i think, but simple. Nothing wrong with being simple, and therefore both fast and easy to understand by a wider audience. The only downer I can immediately think of though is that whitespace isn't accommodated, but who really ends a fi

Re: [PHP] ereg help!

2008-01-09 Thread Anup Shukla
steve wrote: On Tuesday 08 January 2008 20:30:29 Chris wrote: I usually use preg_* functions so here's my go: echo preg_replace('/\.php$/', '.com', $file); The '$' at the end makes sure it's a .php file and won't cause problems with files like xyz.php.txt . (otherwise I'd just use a str

Re: [PHP] ereg help!

2008-01-08 Thread steve
On Tuesday 08 January 2008 20:30:29 Chris wrote: >I usually use preg_* functions so here's my go: >echo preg_replace('/\.php$/', '.com', $file); >The '$' at the end makes sure it's a .php file and won't cause problems >with files like xyz.php.txt . >(otherwise I'd just use a straight str_replac

Re: [PHP] ereg help!

2008-01-08 Thread Chris
steve wrote: I have a dir of html files that link to websites, i would like to read the dir and print a list of those files as a link. Which the script i have does. I would like to take this one step further and replace the ".html" extension with ".com" so it winds up being: website.com instea

Re: [PHP] ereg help!

2008-01-08 Thread Casey
On Jan 8, 2008, at 5:45 PM, steve <[EMAIL PROTECTED]> wrote: I have a dir of html files that link to websites, i would like to read the dir and print a list of those files as a link. Which the script i have does. I would like to take this one step further and replace the ".html" extension

Re: [PHP] Ereg help

2002-10-25 Thread Rick Emery
- Original Message - From: "William Glenn" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, October 25, 2002 10:34 AM Subject: [PHP] Ereg help Hey all, I've been fighting this all night, I need a bit of help. I have a string like. #21-935 Item Description: $35.95 Where the pa

Re: [PHP] ereg help

2001-12-03 Thread J Smith
Something like this will work: eregi("^id \{([a-z]*),([a-z]+),([a-z]+)\} \[(.+)\]$", $str, $regs); $regs will be an array containing: [0] => "id {name,title,nick} [http://www.php.net]"; [1] => "name" [2] => "title" [3] => "nick" [4] => "http://www.php.net"; If course this isn't very foolproof

Re: [PHP] ereg help

2001-12-03 Thread Jim
This is a good starter about PHP and regular expressions. http://www.phpbuilder.com/columns/dario19990616.php3 >- Original Message - >From: "Valentin V. Petruchek" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Monday, December 03, 2001 6:35 PM >Subject: [PHP] ereg help > > >> I'm

Re: [PHP] ereg() help, plz

2001-07-15 Thread Thomas R. Powell
Try this, while ($file_name = readdir($dir2)) { if ($file_name!="." && $file_name!=".." && $file_name!="head.jpg" && !ereg(^tn_,$file_name)) { $files[]=$file_name; } } $numfiles = count($files); for ($i=$g; $i<$numfiles; $i++){ echo $files[$i]; } Tom At 09:45 PM 7/14/01 -0400, you wrote: >