Perl условие

Discussion in 'PHP' started by zeroDay27, 3 May 2014.

Thread Status:
Not open for further replies.
  1. zeroDay27

    zeroDay27 New Member

    Joined:
    13 Jan 2014
    Messages:
    11
    Likes Received:
    0
    Reputations:
    0
    Здравствуйте , подскажите как записать строчку :
    Code:
    http://site.ru/auth.php?&to=&s=0&capt=[COLOR=Red]878371319020[/COLOR]&dif=1
    В таком условии:

    Code:
    if ($capt = "http://site.ru/auth.php?&to=&s=0&capt=[COLOR=Red][Какое-нибудь число от 4 до 7 символов][/COLOR]&dif=1")
    {
    .....
    ....
    ....
    }
    
     
  2. ph1l1ster

    ph1l1ster Elder - Старейшина

    Joined:
    11 Mar 2008
    Messages:
    396
    Likes Received:
    153
    Reputations:
    19
    Code:
    #!/usr/bin/perl
    $string = "http://site.ru/auth.php?&to=&s=0&capt=1234&dif=1";
    
    while ($string =~ m/http:\/\/site.ru\/auth.php\?&to=&s=0&capt=(.*)&dif=1/g) {
        if (length($1)<=7 && length($1)>=4){
        	print "True\n"; 
        	}
     	    	else {
    	    			print "False\n";
    	}
    }
    
    [Perl] Новичкам: задаем вопросы
     
    #2 ph1l1ster, 3 May 2014
    Last edited: 3 May 2014
  3. genom--

    genom-- Elder - Старейшина

    Joined:
    9 Jul 2006
    Messages:
    668
    Likes Received:
    416
    Reputations:
    288
    или так

    $string="http://site.ru/auth.php?&to=&s=0&capt=1234&dif=1";
    $string=~/capt=(.*)/ig;print 'tyt vmesto vivoda delaem 4to nado' if $1>=1000;
     
Thread Status:
Not open for further replies.