Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #16163
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: How i can get preg_match by url? |
| Date | 2016-01-08 11:42 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <87oacws3f1.fsf@bsb.me.uk> (permalink) |
| References | <e274c513-b21b-4110-a19a-b45e96327f37@googlegroups.com> |
thaoluangiavang@gmail.com writes:
> I want find all urls match with one url. i try code below:
> <?php
> $url_regex = '^http://toilatester.com/category/?xv=.*';
You need a delimiter round the pattern. Most often that's / but in this
case you'll end up having to quote all those /s if you do that. You can
use all sort of characters but I like to use curly brackets. Then you
need to quote the special character ? so that it means a literal ? and
not, as yo currently have it, that the / is options. Also, you don't
need .* at the end. If the previous part matches it's going to match
with .* also, and if the previous part does *not* match it won't just
because you got .* there:
$url_regex = '{^http://toilatester.com/category/\?xv=}';
<snip>
--
Ben.
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How i can get preg_match by url? thaoluangiavang@gmail.com - 2016-01-07 20:03 -0800
Re: How i can get preg_match by url? "R.Wieser" <address@not.available> - 2016-01-08 10:15 +0100
Re: How i can get preg_match by url? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-01-08 11:42 +0000
Re: How i can get preg_match by url? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-09 10:55 +0100
Re: How i can get preg_match by url? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-09 11:00 +0100
Re: How i can get preg_match by url? SM Bestvideo <thaoluangiavang@gmail.com> - 2016-01-08 20:46 -0800
Re: How i can get preg_match by url? Luuk <luuk@invalid.lan> - 2016-01-09 11:17 +0100
csiph-web