Hack Forums
[.NET] regex how to fix this regex code to get matching domain links ? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] regex how to fix this regex code to get matching domain links ? (/showthread.php?tid=4187697)



regex how to fix this regex code to get matching domain links ? - polas6 - Apr 22, 2014

I need to fix this regex code and i do not know what is wrong with it it is not mine code.

what it does so it can scrape links from google and put all domain urls with something.com.

What i want that this code would work correctly so just scrape correct domain name links.

But now this code does like random links not as i type keyword to get links from the textbox and put all matching links into listbox but not random.

Here is the code:

PHP Code

<?php 
http
(s?)://([\w-]+\.)+[\w-]+ 

How to fix it ?


* - TheBarret - Apr 22, 2014

Code
((?:http|https)(?::\/{2}[\w]+)(?:[\/|\.]?)(?:[^\s""]*))

- B


* - polas6 - Apr 23, 2014

the code works but it gives me like this and this is what i do not like it and do not want :(

http://www.hourb.com/&amp;sa=U&amp;ei=DIhXU-XLDKjC7AaIkIDgDQ&amp;ved=0CDwQFjAB&amp;usg=AFQjCNH5Ux9SKMjxFQ80x0U_jTKDJEkfyA

how to do like that ?
http://www.hourb.com

Thanks again.


* - Volim te - Apr 23, 2014

Code
(https?://[-a-zA-Z?-??-?()0-9@:%_+.~#?&;//=]+)

Try that I hate regex so much!


* - polas6 - Apr 23, 2014

[img]http://i55.fastpic.ru/big/2014/0423/f3/4e2cb724fc9c7c89aa689a3b25d374f3.png[/img]


It give the same results and one before ;(


This is awesome to use regex only if you use new thread ;)
It does job very fast this program can scrape 1000 links and no ban from google :)
But only using thread works.


* - TheBarret - Apr 23, 2014

Com'n goddamned are u that stupid and lazy? modify the damn regex we fucking spoon fed you every pattern for any domain, and still your begging for more spoon feeding.

im done with you.


* - polas6 - Apr 23, 2014

That's where is the problem why i'm asking you to help to solve the problem cuz i do not know regex coding just to know one thing how to use them.

and i'm not stupid or lazy ;)


* - xNjQ8x - Apr 24, 2014

convert links to URI and take the domain

Code
msgbox( ToURI("http://site.com/?longtext").host )
    Function ToURI(ByVal link As String) As Uri
      Return New Uri(link)
    End Function



* - polas6 - Apr 25, 2014

I want to use it in listbox not with msgbox ?
I wanna list all found domains in listbox cuz i use only listbox as you see in the picture ;)


* - Moen - Apr 25, 2014

(Apr 25, 2014 04:04 AM)polas6 Wrote:  I want to use it in listbox not with msgbox ?
I wanna list all found domains in listbox cuz i use only listbox as you see in the picture ;)

Code
MsgBox(ToURI("http://site.com/?longtext").Host)

is the short version of

Code
Dim something As String
something = ToURI("http://site.com/?longtext").Host
MsgBox(something)

I hope you understands this and can use it 😝