Domain Expiration Date: Mon May 23 23:59:59 GMT 2016 how can i get 23 May 2016 via regex? is that possible as i will use it in my script for other domains formatted whois like that
If that's always formatted that way, you don't need regex. You could just do a simple explode (or, rather, two explodes) and then pull the info from the array returned
You may be better off with that explode only splitting by the first colon... list($title, $date) = explode(':', $line, 2); Then you could use dateTime::createFromFormat to turn it into a proper dateTime object so you could do whatever you wanted with it, in your case: Mon May 23 23:59:59 GMT 2016 $date = DateTime::createFromFormat('D M d H:I:S e Y'); The M and d above may be L and j respectively, hard to tell from that particular date if it's three letter or full month name, or leading zero on days or not... but createFromFormat is usually pretty forgiving on that. http://php.net/manual/en/datetime.createfromformat.php PHP... yeah, there's a function or object method for that...
Fancy - haven't really encountered createFromFormat before. Seems to be a better solution, depending on what is needed.
Did we mention I read two pages of PHP.net a night before bed? There's a LOT of stuff I see people "brute force" that I go "wait, doesn't PHP already have a function for that?". Using the native functions which are most always compiled code is most always going to be faster than hard-coding data processing; it's one of PHP's biggest strengths... But it's also a weakness as the function and object libraries are so huge, nobody can remember all of it at once. It's why I try to just remember "there is a function for that" and then pull it up on php.net when I need to use it. I remembered that object method existed, but I forgot the exact syntax or even it's full and proper name -- so I had to look it up while posting. Part of why despite all my complaints about PHP it's still my first choice for web programming -- the robust function library and brilliant documentation that leaves every other blasted language in the dust on both counts. Again though, I was spoiled by the really good Borland print manuals in the late '80's and early '90's, so I come at what I expect for documentation with far higher expectations than everyone else.
What I wish for is a better search-function on php.net. More like Googles "guesswork" - "did you mean to search for this" and so forth. That would help, especially when you can't remember the exact name of the function, and have to go on "tags", not to mention the absolutely horrendous mix-matching of function names in PHP. Some are with camel-case, some with underscore, some without anything at all. Sometimes, it's very annoying.