Jump to content

dotolee

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dotolee's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ChristianF - Thanks for the response. I just want to say that I realize it might be frustrating to reply to folks who don't do their homework. Having said that, I did take your suggestion and I read up on the function as I mentioned in my post. I reviewed their telephone example and had additional questions. Sometimes, its not that people are being lazy by just asking questions. They may have actually tried to do their homework but need an additional explanation, and hence decide to post a question.
  2. I chnaged the code to read: echo 'starting regex test<BR>'; $data = "c799 1 000ffe-fcc811 1 000ffe-fcc86f 1 000ffe-fcc898 1 000ffe-fcc92d 1 000ffe-fcc934 1 000ffe-fcc965 1 000ffe-fcc96b"; $pattern="/([a-f0-9]){6}-([a-fa-f0-9]){6}$/i"; echo "the pattern we are using is:".$pattern."<BR>"; if (preg_match_all($pattern,$data,$matches, PREG_SET_ORDER)) { //echo 'Matches we found:'. print_r($matches, true); print_r($matches[0][0]); echo"<BR>"; print_r($matches[0][1]); } else { echo "No, the mac address is wrong"; } And this is the output i'm seeing on the webpage: starting regex test the pattern we are using is:/([a-f0-9]){6}-([a-fa-f0-9]){6}$/i 000ffe-fcc96b e I guess i don't understand why it's printing the "e"? I've tried reviewing the documentation found here: http://ca2.php.net/manual/en/function.preg-match-all.php and i do understand the results i get with their telephone example... Is there any way i can get a count of the number of matches it found? Thanks
  3. Hi there. I have the following php code: <?php echo 'starting regex test<BR>'; $data = "c799 1 000ffe-fcc811 1 000ffe-fcc86f 1 000ffe-fcc898 1 000ffe-fcc92d 1 000ffe-fcc934 1 000ffe-fcc965 1 000ffe-fcc96b"; $pattern="/([a-fA-F0-9]){6}-([a-fa-fA-F0-9]){6}$/i"; echo "the pattern we are using is:".$pattern."<BR>"; if (preg_match($pattern,$data)) { $matches = preg_match($pattern,$data, $matches); echo 'Matches we found:'. print_r($matches, true); } else { echo "No, the mac address is wrong"; } ?> I'm just wondering why it only finds one match.... also, what is the proper way to define a hex value in regular expressions? thank you.
  4. You don't As per usual w3schools have published a terrible example of PHP. Javascript adds elements directly to the DOM. You won't see it in a normal "view source". Use a more robust tool like Firebug or Chrome's dev tools. so what is the proper way to send a response back to the calling page? or do you just write straight html as you normally would..
  5. hi there. i'm following an example found here: http://www.w3schools.com/php/php_ajax_database.asp in their example, the page that gets the new data from the database returns a table. so here are my questions. why do we need to "echo" the results back? also, when i do a view source on my main page, i don't see the latest values that get gnereated by the ajax code. i see the table values that initially display when i open the main page. is this correct? again, is this because the echo?
  6. hi there. can someone tell me how to get this to print out the real minutes instead of the month? echo date("M-d-Y H:m:s", mktime()); i've read http://www.sqlite.org/lang_datefunc.html but i can't seem to get it to work.
×
×
  • 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.