-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
preg_match_all("~<td class='right_column'>.*?</td>~is",$content,$matches);
-
Unfortunately, 9/10 times, there is always someone out there enabling their laziness by answering their question anyways.
-
mmhmm...so making a joke is bad but calling people idiots is okay? I suggest trying www.hellokittyislandadventure.com/forums
-
You mean the "Oh...that's it? Come back when you grow up, boy" face?
-
if(!preg_match("/^[-'a-z0-9]{8,12}$/i",$_POST['username'])) You may need to stripslashes $_POST['username'] before preg_matching though. Also, that pattern does not prevent stuff like this from matching: a-----bc a''''''''bc a-b-c-d-e ------abc-- etc..
-
yes, but it only works within the pattern or within the 2nd argument of preg_replace. You can't turn around do for instance $num = $1; If you want to be able to do something like that, then you need to use preg_match or preg_match_all and it will be assigned to an array specified in the 3rd argument.
-
Because otherwise the world would be a dull place. It seemed like you started off by acknowledging the joke (the "lol, I wish...") but then later on forgot all about that and chose to go on the offensive. Don't be so uptight. It's just some random dude on some random board on some random site on the internet.
-
[SOLVED] Finding a certain string in a bunch of text
.josh replied to Asheeown's topic in Regex Help
preg_match('~Requires level \d+~i',$Info,$match); print_r($match); -
I do it for the chicks.
-
how to translate a php script to another language ?
.josh replied to samoi's topic in PHP Coding Help
dude I don't know why you're sitting there gloating. You admitted you misread it in the first place. Even a blind man will hit the bullseye if he gets enough shots. Too bad he shoots everything else in the process. -
how to translate a php script to another language ?
.josh replied to samoi's topic in PHP Coding Help
nah redarrow has it covered. 2hrs from now, we'll have a working php-to-spanish script. gogogogogo -
php3 upgrade to php5. set_cols function missing?
.josh replied to ottos13's topic in PHP Coding Help
Yeah I saw the copyright date and was like ... writing php3 scripts in 2005 wtf? some method in some class that extends some other class that extends yet another class is trying to call a method that apparently doesn't exist. He says it was working before the upgrade, and now it's giving that error after the upgrade. My first guess is he has uploaded some older file where it doesn't exist yet, or something. -
how to translate a php script to another language ?
.josh replied to samoi's topic in PHP Coding Help
delicious, sweet irony, how I love thee. -
php3 upgrade to php5. set_cols function missing?
.josh replied to ottos13's topic in PHP Coding Help
Holy Crap...upgrading from php3?!?!?!? -
If you're asking yourself these questions, then you probably don't need to go OOP. You go OOP for the same reason you went to putting things into functions: re-usability.
-
Nothin' else, could just separate it: $t = "{$type}_id"; mysqli_query($db , "UPDATE {$type}s SET login_hold = 0 WHERE $t = '{$row[$t]}' LIMIT 1");
-
okay if I read/understood that right, it sounds like you are grabbing more than one page worth of info from the db and want to paginate it. The point of pagination is that you only grab one page worth of data at a time. Think maybe you need to back up a few steps in your process and rethink the whole pulling stuff out of the db thing. Or else, you need to be a bit more specific.
-
have you looked into pcntl? I've never really used it but if I understand it correctly, pcntl_fork returns the child's process id if you're in the parent, 0 if you're in the child, so you should be able to use an if statement to figure out whether you're currently in the parent or child process, and do stuff based off that. Like for instance, you can call pcntl_wait or pcntl_waitpid to make the current process wait for the other one to finish.
-
[SOLVED] Splitting a large table in to smaller chunks.
.josh replied to mfallon's topic in PHP Coding Help
http://www.phpfreaks.com/tutorial/basic-pagination -
I believe you are talking about threading, in which case, php does not support that. You can look into forking, which mostly simulates it.
-
array_count_values arsort
-
You can do it in one regex, doing something like this: '~<td.*?class="(?:file|crcsize|seeds|conns)"[^>]*>\s*(??:<a href="([^"]*)" title="([^"]*)">(.*?)</a>)|(?:<b>)?(.*?)(?:</b>)?)\s*</td>\s*~is' What that basically does is look for any td with class file, crcsize,seeds, or conns. Then it will either look for a link tag and match the stuff inside it, or just do a generic match everything, to accommodate the different scenarios. This pattern will match all of your info. It will match the href, title, stuff between link tags, general stuff between the td tags, check for bold tags, etc.. for any of those 4 classes. The main problem with this pattern is that it will make for some funky ass result formatting. Try it out and do a print_r on the results to see what I mean. There's a whole lot of empty elements, for things that don't match for any given td. Your best bet is to break it down into 2 different regexes. First match the link stuff, then match the other class td's.
-
another problem with your pattern though is that it doesn't take into consideration other things that might be in your td tags, or certain ones not being there at all. For example, the example you posted: <td class="file"> <a href="link.com" title="title">X</a> </td> <td class="crcsize">X</td> <td class="seeds" colspan="7"></td> That has a colspan in your seeds td, and also your conns td is missing. Both of those things will make your regex fail
-
no. Negative character classes only match one character at a time. So it will match anything that is not a < or /, not a string of "</" together. What you want is negative lookahead. Something like (?!</a>).*?
-
very first thing I see wrong in your pattern is this: <td class="crcsize">([^"]*)</td> I think maybe you missed the point of negated char classes vs. match-alls. ([^"]*) is specific to getting stuff between quotes. For example: href="([^"]*)" means to keep matching until you hit a double quote. Well does that really make sense within the context of this? <td class="crcsize">([^"]*)</td> That says to match <td class="crcsize"> and then keep matching until you hit a quote, and then </td> so it's not going to match until it finds the first "</td> in your string, which looks like according to your posted example, doesn't exist.