-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
I suggest you take on shitty clients so you can be extra specially challenged with trying to find workarounds for things. I can't even begin to tell you how much I've learned over the years due to so-called web devs of clients who without exaggeration, literally fail at even c/p'ing shit.
-
Jesi was actually one of the first members of PHPFreak Recommended group when PFR was first created, before there was even a Guru group.
-
I have... HDD: 600gb ram: 6gb graphics: 1gb ram ati radeon 5700 processor: AMD Phenom 9550 Quad-Core Processor (4 CPUs), ~2.2GHz monitors: 2x20" OS: Vista 64 bit home premium I guess my e-peen isn't as big as you guys' but it's more than plenty to get my job done and play some games on something other than lowest settings
-
I don't have to explain my art to you, Warren.
-
I made that just for you. Fear my photoshop skillz
-
I think this should cover hyphens preg_match_all('~Med Given: ((??!-\s*\d{1,2}:\d{1,2} (?:A|P)M|Med Admin Route:|Dosage:|$).)+)(?:\s*-\s*(.*?(?:A|P)M))?(?:\s*Med Admin Route:((??!Dosage:|$).)+))?(?:\s*Dosage:\s*(.*))?~',$content,$matches);
-
preg_match_all('~Med Given: ((??!-|Med Admin Route:|Dosage:|$).)+)(?:\s*-\s*(.*?(?:A|P)M))?(?:\s*Med Admin Route:((??!Dosage:|$).)+))?(?:\s*Dosage:\s*(.*))?~',$content,$matches);
-
what about being in different orders? Like... Dosage: xxx Med Admin Route: xxx Med Given: xxx
-
preg_match_all('~Med Given: ((??!-|$).)+)(?:\s*-\s*(.*?(?:A|P)M))?(?:\s*Med Admin Route:((??!Dosage:|$).)+))?(?:\s*Dosage:\s*(.*))?~',$content,$matches);
-
// example haystack $content = <<<BLAH Med Given: Versed - 9:50 PM Med Admin Route: Intravenous Dosage: 20.00 MG Med Given: Lidocaine - 9:50 PM Med Admin Route: Intravenous Dosage: 150.00 MG Med Given: Succinylcholine - 9:50 PM Med Admin Route: Intravenous Dosage: 200.00 MG Med Given: Oxygen - 7:23 PM Dosage: 2.00 L/MIN Med Given: Vancomycin Med Given: Fentanyl Med Given: Dopamine Med Given: Dextrose Med Given: Gentamicin BLAH; preg_match_all('~Med Given:\s+([^\s]+)(?:\s+-\s+(.*?(?:A|P)M))?(?:\s+Med Admin Route:\s+([^\s]+))?(?:\s+Dosage:\s+(.*))?~',$content,$matches); array_shift($matches); $c = count($matches[0]); for ($x=0;$x<$c;$x++) { $rows[$x] = array( 'med' => trim($matches[0][$x]), 'time' => trim($matches[1][$x]), 'route' => trim($matches[2][$x]), 'dosage' => trim($matches[3][$x])); } // output echo "<pre>"; print_r($rows); output: Array ( [0] => Array ( [med] => Versed [time] => 9:50 PM [route] => Intravenous [dosage] => 20.00 MG ) [1] => Array ( [med] => Lidocaine [time] => 9:50 PM [route] => Intravenous [dosage] => 150.00 MG ) [2] => Array ( [med] => Succinylcholine [time] => 9:50 PM [route] => Intravenous [dosage] => 200.00 MG ) [3] => Array ( [med] => Oxygen [time] => 7:23 PM [route] => [dosage] => 2.00 L/MIN ) [4] => Array ( [med] => Vancomycin [time] => [route] => [dosage] => ) [5] => Array ( [med] => Fentanyl [time] => [route] => [dosage] => ) [6] => Array ( [med] => Dopamine [time] => [route] => [dosage] => ) [7] => Array ( [med] => Dextrose [time] => [route] => [dosage] => ) [8] => Array ( [med] => Gentamicin [time] => [route] => [dosage] => ) )
-
So you want to do a splash or preloader screen? ugh, those are so annoying. You should stay away from doing that unless your site really is loading something that takes a good amount of time to load. But if you insist, it would be easier to give it its own page and then redirect to real page when it's done.
-
I kinda find it odd that the makers/support staff of a CMS would fail to catch this error...anyways...problem is that you are using @ as the regex delimiter but you have it in the middle of the pattern instead of at the end. elseif($moduleinthisgroup[$som_groupmenu][$keyinthisgroup]=="Lien externe" && !preg_match("@modules.php?name=@i", $linkinthisgroup[$som_groupmenu][$keyinthisgroup]) && !preg_match("@((http(s)?)|(ftp(s)?))://".$_SERVER['SERVER_NAME']."/modules.php\?name=@i",$linkinthisgroup[$som_groupmenu][$keyinthisgroup])) {
-
as in, the whole page? That doesn't really make sense..you're basically asking "How do I wait until the page is loaded, to show the page?"
-
while (!color.match(/^#[A-Fa-f0-9]{6}$/)) { - you don't need to escape # - you don't need to do #{1} as it is superfluous - hexadecimal numbers only contain letters a-f not a-z - main thing you were missing was start and end of string anchors (^...$) which tells the regex engine that it must start with the # followed by 6 a-f0-9 and then nothing else.
-
1) That's javascript, not java. Two totally different things, despite similar names 2) javascript cannot send emails. You have to submit the information (like when user clicks on form submit button) and do it server-side with for instance php's mail() function.
-
build it from scratch. That's about as customizable as it gets.
-
/* function based on the following rules: 1) username can have 0 or more of 0-9!@#$%^&*() but it must be preceded by a ` 2) username can have 0 or more letters, case insensitive returns true if valid, false if not */ function validateUsername($username) { // check to see if $username only contains valid chars if(!preg_match('~^[a-z0-9!@#$%^&*()`]+$~i',$username)) return false; // check if ` precedes symbol or number if(!preg_match('~`[0-9!@#$%^&*()]~',$username)) return false; // valide username return true; } // end validateUsername
-
Okay, you have a link like http://www.yoursite.com/news/search?query=something And you want it to be redirected to http://www.yoursite.com/news/search/query/something Put this in your .htaccess file: .htaccess RewriteEngine on RewriteCond %{QUERY_STRING} ([^=]+)=([^&]*) RewriteRule ^news/search news/search/$1/%2 [R=301]
-
good luck on your reading on lookarounds...they are one of the hardest parts of regex to grasp In theory they seem easy enough but in practice...lol you will most likely bang your head on the wall many times
-
it's called a positive lookahead
-
umm, my code is being done with a single regex....it's just followed by a condition based on what is matched.... Anyways... I guess positive lookaheads is a clever way to do it without a followup condition. That pattern will look for at least 1 of each. If you want to do at least 2 of each: return preg_match('~^(?=.*[^a-zA-Z](?=.*[^a-zA-Z]))(?=.*[a-z](?=.*[a-z]))(?=.*[A-Z](?=.*[A-Z])).{5,20}$~',$password); This also will check to make sure the password is between 5 and 20 chars long (which looks like you figured that bit out)
-
does setInterval use a lot of ram/cpu if you..
.josh replied to shortysbest's topic in Javascript Help
If you are wanting something to be run every X seconds indefinitely, use setInterval() instead of setTimeout(). They are practically the same thing but with setInterval() you don't have to take the extra step of having your function recursively call itself. In and of itself it doesn't matter how many seconds you delay it. What matters is what you are actually doing when the function is run. For instance, if you are appending a new element to a global or static array, adding new content to page, etc... each iteration, things are going to add up. Iterating every 1s will give you 60 new elements in 1 minute, vs. 6 new elements, if you are iterating every 10s. -
I really frakking hate it when forms require stuff like this. Put a warning up and let ME decide how "strong" my password should be. Anyways... another thing you forgot to consider is that someone can have for instance "1AaBb2" and that should be fine....(notice how 2xwhatever is NOT together) but your regex requires them to be together. function validatePassword($password) { preg_match_all('~([a-z])|([A-Z])|([^a-zA-Z])~',$password,$matches); if ( (count(array_filter($matches[1]))>1) && (count(array_filter($matches[2]))>1) && (count(array_filter($matches[3]))>1) ) return true; return false; } // end validatePassword
-
That is exactly what mod_rewrite does. Whenever a request is made to your server, regardless of whether a user clicks on a link, submits a form (action="..."), enters url in address bar, clicks a bookmark, etc... it will redirect to specified url. You said this was your before: news/search/?seach=value after: news/search/value ...and that's what my regex does.... But now it looks like you are trying to do: before: /news/search/?query=test123 after: /news/search/query/test123 is that what you are trying to do? If so, then it should be: $pattern = "~news/search/\?([^=]+)=(.*)~"; ...but again, I really think you should be using mod_rewrite.