Re: Unexplained Issue Using Regex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----------------------------------------------------------------------
Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get
a Free CD of Ubuntu mailed to your door without any cost. Visit :
www.ubuntu.com
----------------------------------------------------------------------


On Sat, Mar 7, 2009 at 3:46 PM, Nitsan Bin-Nun <nitsan@xxxxxxxxxxxx> wrote:

> There is no reason to share the code because it happens with almost ALL the
> regex's I'm using :(
>
> But I worked this out using Todd's solution.
>
> Thank you all for trying to help.
>

hahaha   FUNNIEST ever ..... well we can conclude that you were wrong with
your codes of regex. :D

>
>
> On Sat, Mar 7, 2009 at 11:06 AM, 9el <lenin@xxxxxxxxxxxxx> wrote:
>
>>
>> On Sat, Mar 7, 2009 at 2:37 PM, Jochem Maas <jochem@xxxxxxxxxxxxx> wrote:
>>
>>> Nitsan Bin-Nun schreef:
>>> > Hi lista,
>>> >
>>> > I have been trying to figure this out for the last couple of hours but
>>> I'm
>>> > lack of luck.
>>> > Take a look at these regex's, the string that was inputed into the
>>> > preg_replace (using Uis modificators) and the results:
>>> > (the lists have correspondence to each other)
>>> >
>>> > ORIGINAL STRING
>>> > ----
>>> >
>>> > http://www.zshare.net/video/541070871c7a8d9c
>>> > http://www.guba.com/watch/2000821351
>>> > http://www.veoh.com/videos/v4609719YfsCFpf
>>> >
>>> >
>>> > REGEX USED (with Uis modificators)
>>> > ----
>>> > http:\/\/(www\.|)zshare\.net\/video\/([^\/]+)               $3
>>> > http:\/\/(www\.|)guba\.com\/watch\/([0-9]+)              $3
>>> > http:\/\/(www\.|)veoh\.com\/videos\/([^\/]+)
>>> >
>>> > THE RETURNED STRING
>>> > ----
>>> > 41070871c7a8d9c
>>> > 000821351
>>> > 4609719YfsCFpf
>>> >
>>> > If you will go through this carefully you will notice that the first
>>> > character of each matching group is being deleted.
>>> > The regex's and the replacements string are being fetched from the
>>> database
>>> > (mysql) and goes straight to the preg_replace function with the
>>> original
>>> > string.
>>> >
>>> > I have no idea why this happens.
>>> > I'm looking forward for your opinions and suggestions.
>>>
>>> php -r '
>>> var_dump(preg_replace("#http:\/\/(www\.|)zshare\.net\/video\/([^\/]+)#Ui",
>>> "\\2", "http://www.zshare.net/video/541070871c7a8d9c";));
>>> '
>>> string(16) "541070871c7a8d9c"
>>>
>>> given the above test I don't see the problem with the regexp
>>> (but you don't actually show the code so it's hard to tell), I'd
>>> probably look else where for the char munching culprit.
>>
>>
>> Well, yes if Nitsun is not sharing his piece of code we will have to guess
>> wildly... but why? :)
>>
>>>
>>>
>>> >
>>> > Regards,
>>> > Nitsan
>>> >
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux