Raised This Month: $ Target: $400
 0% 

Regex issue, how to get the both numbers from the line?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Kapuzzino
Member
Join Date: Jan 2014
Old 02-02-2014 , 08:30   Regex issue, how to get the both numbers from the line?
Reply With Quote #1

It returns me only the first number, instead of both

PHP Code:
new str[] = "that string contains 55 and 46 numbers"
new pattern[] = "(\d{2})"
new flags[] = "mis"
new num,err[128]
new 
str2
new Regex:re regex_match(str,pattern,num,err,127,flags)
server_print("Result=%d Num=%d Error=%s",re,num,err)

if (
re >= REGEX_OK)
{
    new 
str2[64]
    new 
i
    
   
for (i=0i<numi++)
   {
    
regex_substr(re,i,str2,63)
    
server_print("Substring %d: %s"istr2)
   }
}
          
regex_free(re
results:

Code:
Substring 0: 55
Substring 1: 55

Last edited by Kapuzzino; 02-02-2014 at 08:40.
Kapuzzino is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:16.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode