Re: Reg Expression Search
| From: | Joe Stump | Date: | Tue, 17 Oct 2000 07:45:53 +0000 |
| Subject: | Re: Reg Expression Search | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-20564@lists.php.net to get a copy of this message | ||
If you just want the string up until the first \ then do this:
$junk = 'C:\foo\bar\file.txt';
$foo = explode('\',$junk);
// should return C:
echo $foo[0];
// should return foo
echo $foo[1];
// should return bar
echo $foo[2];
// should return file.txt
echo $foo[3];
--Joe
On Tue, Oct 17, 2000 at 05:14:28PM +0930, Scott Mebberson wrote:
> Hi Guys,
>
> I have real problems with reg exps. I hate them.
>
> I need to do a search on string that will look like this "C:\temp\bg.gif"
> and I want to take from the end of string up until the first backslash. The
> var $realVal contains the string. So I can either take it from --\[*].gif--
> or --\[*].jpg--
>
> thanks for all help
>
> scott.
>
>
>
> --
> 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
/*****************************\
* Joe Stump *
* www.Care2.com *
* Office: 650.328.0198 *
* Extension: 122 *
\*****************************/
http://www.miester.org/Joe/Stump/Joe_Stump_resume.html
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GB/E/IT d- s++:++ a? C++++ UL++$ P+ L+++$ E----! W+++$
N+@ o? K? w---! O-@ M+@ V-! P(++) PE(+) Y+@ PGP+++@ t+@
5? R-! tv@ b+ DI++@ D(++++) G++@ e+@ h@ r+! z(+++++**)!
------END GEEK CODE BLOCK------