| | |||||
| ||||||||
| CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) | ||||
| Account Closed Join Date: Sep 2006
Posts: 1,075
![]() ![]() ![]() ![]() ![]() ![]() | |
| Quote: |
|
<html> <head> <title>Domain List Cleaner</title> <body> <center> <form method="post" action=""> <textarea name="domains" rows="15" cols="60"> <?php $temparray = array(); $domains = $_POST['domains']; if ($domains) { $list = split(" +", $domains); foreach ($list as $value) { preg_match("/[a-z-A-Z0-9-]+\.(com|net|org|us|biz|info|cc|ca|br|tv|ac|ag|am|a t|be|bz|ch|cn|de|es|eu|fm|gs|im|in|io|jobs|jp|la|l i|mn|mobi|ms|name|nl|pl|ru|sc|se|sg|sh|tc|tk|tm|tw |vc|vg|uk|ws)/", $value, $matches); for ($i = 0; $i < count($matches); $i++) { array_push($temparray, $matches[0]); } } $uniquearray = array_unique($temparray); foreach ($uniquearray as $uniquevalue) { echo "$uniquevalue\n"; } } ?> </textarea> <br /> <input size="45" type="submit" value="Submit"> </form> </center> </body> </html> |
| | #5 (permalink) |
| NamePros Member Join Date: Jun 2006
Posts: 195
![]() | Well, I can't understand what you trying to do. Maybe you like to explain to me in more detail so I can assist you on the problem?
__________________ tanfwc [ My HomePage ] My Project : Free Image Hosting # Shorten your URL! # Submit your proxy Cheap VPS on GNAX Network -- starting US$12.99/mo! |
| |
| | THREAD STARTER #6 (permalink) | ||||
| Account Closed Join Date: Sep 2006
Posts: 1,075
![]() ![]() ![]() ![]() ![]() ![]() |
What I need is to include the extension org.uk in that sequence of top TLDs, which are listed Without the "." in front of them. The extension org.uk has a "." between the org and the uk, what interferes in the results. That script is a Domain List Cleaner where all characters/words that are not part of a domain then are excluded from the results. The way the list is now make domains like test.org.uk to be excluded as well, when they shoudn't. For example, the way the script is now, an example list like: 1. test.com 2 . test.net zxzx zxz.xzxzxz 3. test.org.uk 4. test.ca .kjkjk 5. 4444 test.us 1212121212112 ????: NamePros.com http://www.namepros.com/showthread.php?t=302379 would return only: test.com test.net test.ca test.us thus also excluding the test.org.uk domain as garbage simply because it has a "." in there. So the question: How to include the org.uk in that sequence of top TLDs? Your help is appreciated.
Last edited by YesBrilliant; 03-08-2007 at 09:02 PM.
| ||||
| |
| | #8 (permalink) |
| NamePros Member Join Date: May 2006
Posts: 160
![]() | Oh, I think I see the problem... the .org part is matching before the regexp can match it with .org.uk. You could probably play with the greediness of the regexp, but it might just be easier to add 'org.uk' BEFORE the 'org' option... |
| |
| | THREAD STARTER #9 (permalink) | ||||
| Account Closed Join Date: Sep 2006
Posts: 1,075
![]() ![]() ![]() ![]() ![]() ![]() |
I tried to do that but it gets worst. As I don't know more of coding I'll leave it the way it is. Thanks anyway. | ||||
| |
| | THREAD STARTER #11 (permalink) |
| Account Closed Join Date: Sep 2006
Posts: 1,075
![]() ![]() ![]() ![]() ![]() ![]() | I just updated the first post the way I am using now. However, still getting incorrect results. I also tried to put the org.uk in the start of the sequence but same error. Another example, checking: wwwwwwwww.org.uk wwwwwwwww.co.uk wwwwwwwww.org wwwwwwwww.com wwwwwwwww.ws Returns only: wwwwwwwww.org.uk wwwwwwwww.org Thanks again, I really appreciate your help. Mark. |
| |
| | #12 (permalink) | ||||
| NamePros Member Join Date: May 2006
Posts: 160
![]() |
????: NamePros.com http://www.namepros.com/showthread.php?t=302379 Secondly, unless you have that original code somewhere, you're going to have to take my word for it that with that sample set, your original code did the same thing :) The problem that you experienced there is related not to the regular expression being used to match, but the regular expression you're using to split. The split assumes that you have a space on the line: newlines were not being considered... Replace: $list = split(" +", $domains); with: $list = split("[[:space:]]+", $domains); and see how it goes... | ||||
| |
| | THREAD STARTER #13 (permalink) | ||||
| Account Closed Join Date: Sep 2006
Posts: 1,075
![]() ![]() ![]() ![]() ![]() ![]() | |
| Quote: |
| <html> <head> <title>Domain List Cleaner</title> <body> <center> <form method="post" action=""> <textarea name="domains" rows="10" cols="40"> <?php $temparray = array(); $domains = $_POST['domains']; if ($domains) { ????: NamePros.com http://www.namepros.com/showthread.php?t=302379 $list = split("[[:space:]]+", $domains); foreach ($list as $value) { preg_match("/[a-z-A-Z0-9-]+\.(co.uk|org.uk|com.br|org.br|net.br|on.ca|bc.ca| ab.ca|qc.ca|com|net|org|us|biz|info|ac|ag|am|at|be |bz|ca|cc|ch|cn|de|es|eu|fm|gs|im|in|io|jobs|jp|la |li|mn|mobi|ms|name|nl|pl|ru|sc|se|sg|sh|tc|tk|tm| tv|tw|vc|vg|ws)/", $value, $matches); for ($i = 0; $i < count($matches); $i++) { array_push($temparray, $matches[0]); } } $uniquearray = array_unique($temparray); foreach ($uniquearray as $uniquevalue) { echo "$uniquevalue\n"; } } ?> </textarea> <br /> <input type="submit" value="Get a Clean Domain List!"> </form> </center> </body> </html> |