Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #16163

Re: How i can get preg_match by url?

Path csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.php
Subject Re: How i can get preg_match by url?
Date Fri, 08 Jan 2016 11:42:42 +0000
Organization A noiseless patient Spider
Lines 20
Message-ID <87oacws3f1.fsf@bsb.me.uk> (permalink)
References <e274c513-b21b-4110-a19a-b45e96327f37@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="9205"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18aizhqhTLkPLfzRQxNH8QtVNNroJ82L4s="
Cancel-Lock sha1:F+eHlZggCkaXcn0IU3+MA7cM5qU= sha1:NVUaqo+4Ipx0kZR8Da/OyQ8Sxtc=
X-BSB-Auth 1.d440c6559dc8a592f03a.20160108114242GMT.87oacws3f1.fsf@bsb.me.uk
Xref csiph.com comp.lang.php:16163

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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