![]() |
Regex for showthread - Printable Version +- MyBB Community Forums (https://community.mybb.com) +-- Forum: Extensions (https://community.mybb.com/forum-201.html) +--- Forum: Plugins (https://community.mybb.com/forum-73.html) +---- Forum: Plugin Development (https://community.mybb.com/forum-68.html) +---- Thread: Regex for showthread (/thread-194893.html) |
Regex for showthread - Sazze - 2016-06-29 Hi, Been looking around for a while for a good regex that checks for a tid input. Something like: domain.com/showthread.php?tid=[0-9] Help is appreciated, thanks. RE: Regex for showthread - Sazze - 2016-07-01 Still looking for this. RE: Regex for showthread - WallBB - 2016-07-01 Can you tell me what you want to achieve by checking it ? I am trying to understand your requirement so i can answer it. RE: Regex for showthread - sleeping - 2016-07-07 What is wrong with:
From what I can understand it would get any amount of numbers coming after tid and will stop if there is anything not a number after it, for example:
It would stop at & and get you 200. EDIT: If you're using it inside a plugin, you can access $post['tid'] directly if you reference $post, from a postbit. EDIT2: This is what mybb uses for merging threads, which shows you 2 examples on how to get the URL, split and get the tid from it: https://github.com/mybb/mybb/blob/4fad946313a91015bd993aab8f4366c9456350c9/inc/tasks/delayedmoderation.php#L108 |