Jump to content

Recommended Posts

now im really stuck ... i work with regex for some time,but not for PHP

can someone help me with this one

(?<full><tr><td>(?<rank>.*?)</td><td><img src="img/race(?<race>.*?)small.gif.*?</td><td>(.*?)?p=(?<pid>.*?)".*?title="(?<name>.*?)".*?</td><td>.*?\?i=(?<aid>.*?)" >(?<aname>.*?)</a></td>.*?>(?<level>.*?)</td>.*?>(?<capture>.*?)</td>.*?>(?<victims>.*?)</td>.*?>(?<victorys>.*?)</td>.*?>(?<defeats>.*?)</td>.*?>(?<goldtook>.*?)</td></tr>){0,100}

 

i think the code is explaining what i want to achieve

thank you

Link to comment
https://forums.phpfreaks.com/topic/187150-regex/
Share on other sites

look what i have tried

$regex = "~(?<full><tr><td>(?<rank>.*?)</td><td><img src=\"img/race(?<race>.*?)small.gif.*?</td><td>(.*?)?p=(?<pid>.*?)\".*?title=\"(?<name>.*?)\".*?</td><td>.*?\?i=(?<aid>.*?)\" >(?<aname>.*?)</a></td>.*?>(?<level>.*?)</td>.*?>(?<capture>.*?)</td>.*?>(?<victims>.*?)</td>.*?>(?<victorys>.*?)</td>.*?>(?<defeats>.*?)</td>.*?>(?<goldtook>.*?)</td></tr>){0,100}~";

 

with no luck...

but is this regex good for php?

didnt work too much with regex in php

Link to comment
https://forums.phpfreaks.com/topic/187150-regex/#findComment-988282
Share on other sites

<tr><td>1</td><td><img src="img/race1small.gif" alt="waslp" ></td><td><a href="?p=35357" title="Minase">Minase</a></td><td><a href="?i=115" >Black</a></td><td align="right">331</td><td align="right">355.938.160</td><td align="right">9</td><td align="right">10.070</td><td align="right">1.835</td><td align="right">1.682.527</td></tr>

 

i have thousands of matches,i want to put every match in array

thx

Link to comment
https://forums.phpfreaks.com/topic/187150-regex/#findComment-988286
Share on other sites

'%(?P<full><tr><td>(?<rank>.*?)</td><td><img src=\"img/race(?<race>.*?)small.gif.*?</td><td>(.*?)?p=(?<pid>.*?)\".*?title=\"(?<name>.*?)\".*?</td><td>.*?\?i=(?<aid>.*?)\" >(?<aname>.*?)</a></td>.*?>(?<level>.*?)</td>.*?>(?<capture>.*?)</td>.*?>(?<victims>.*?)</td>.*?>(?<victorys>.*?)</td>.*?>(?<defeats>.*?)</td>.*?>(?<goldtook>.*?)</td></tr>)%'

 

Try that. Also, what is your php code you are using? are you using preg_match_all?

Link to comment
https://forums.phpfreaks.com/topic/187150-regex/#findComment-988305
Share on other sites

yes but kill me...

 

$regex = '%(?P<full><tr><td>(?P<rank>.*?)</td><td><img src=\"img/race(?P<race>.*?)small.gif.*?</td><td>(.*?)?p=(?P<pid>.*?)\".*?title=\"(?P<name>.*?)\".*?</td><td>.*?\?i=(?P<aid>.*?)\" >(?P<aname>.*?)</a></td>.*?>(?P<level>.*?)</td>.*?>(?P<capture>.*?)</td>.*?>(?P<victims>.*?)</td>.*?>(?P<victorys>.*?)</td>.*?>(?P<defeats>.*?)</td>.*?>(?P<goldtook>.*?)</td></tr>)%';

 

preg_match_all($regex,$string,$matches, PREG_SET_ORDER);
print_r($matches);

 

this returns nothing...

Link to comment
https://forums.phpfreaks.com/topic/187150-regex/#findComment-988317
Share on other sites

<tr><td>1</td><td><img src="img/race1small.gif" alt="waslp" ></td><td><a href="?p=35357" title="Minase">Minase</a></td><td><a href="?i=115" >Black</a></td><td align="right">331</td><td align="right">355.938.160</td><td align="right">9</td><td align="right">10.070</td><td align="right">1.835</td><td align="right">1.682.527</td></tr>

 

that type of strings

 

i have thousands of matches,i want to put every match in array

thanks

Link to comment
https://forums.phpfreaks.com/topic/187150-regex/#findComment-988372
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.