Re: replacing directory references at beginning of file name
| From: | James Holloway | Date: | Tue, 22 May 2001 08:15:41 +0000 |
| Subject: | Re: replacing directory references at beginning of file name | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-53820@lists.php.net to get a copy of this message | ||
Dennis,
NOT tested:
$string = preg_replace("/^(\$|\\\|\/|\.)/i", "", $string);
James.
"Dennis Gearon" <gearond@oit.edu> wrote in message
news:3B098810.34B68FC@oit.edu...
> Could someone please send me the code for doing the above? I have the
> book, "Mastering Regex, blah blah", but I don't have time to read it
> until the end of the school quarter."
>
> I'd like to remove the following chars from the beginning of a string:
> '$', '\', '/', and '.' .
>
> I plan on doing it like so:
>
> while( ereg_replace( $dir_remove_patt, "", $file_name) ){;}
>
> I need the value for $dir_remove_patt, and I would be most grateful. I'm
> a stubborn kind of guy, and I don't usually ask for direct help; I'm not
> a moocher of code. But I could use some help, thanks :-)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>