Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Source - Retrieve the title of a site and add it plus the link to a ListView. & More

Simple as fuck, I know. I made it as an example for some kid. It's a "Site Manager".

Gif:
Spoiler (Click to View)

DL: http://www.coding-forums.com/hf/sources/...d.php?id=4

I also made this as an example and it's in the same project, what I've started to do is just add everything to one huge ass project called "Examples". Right now there are only 2 things that work (out of 3).

Gif:
Spoiler (Click to View)



Thanks for any interest and I hope someone learns something! 🙂
Thread: Backend Web-Dev. - by SomeWhiteGuy

WATCH OUT 'LIL HOE,
MY PARTNA STILL SMOKE ON PAROLE
selling -
megabits.org + freakin.pro
Some l33t coding you got there... Get back on Auxilium SWG... Anyways, nice share.
What do you use to record the gifs?
(Oct 15, 2012 08:23 PM)Plump Wrote:  What do you use to record the gifs?

I use Camtasia Studio to record the GIF's, and also any videos that I happen to upload to YouTube.
Thread: Backend Web-Dev. - by SomeWhiteGuy

WATCH OUT 'LIL HOE,
MY PARTNA STILL SMOKE ON PAROLE
selling -
megabits.org + freakin.pro
I see, thanks a lot sir. :D
Nice share btw.
I don't really know much about RegEx, but from what I got from that expression was that it gets anything that is A-z & 0-9 between the title tags.

What happens if someone uses a character like '-' or '&'?
Nice source, I can think of a project or two i have sitting around I could mod this for. Thanks for sharing :]
(Oct 15, 2012 08:35 PM)Banksу Wrote:  I don't really know much about RegEx, but from what I got from that expression was that it gets anything that is A-z & 0-9 between the title tags.

What happens if someone uses a character like '-' or '&'?

You are correct, and I didn't really think about that.

Easy work-around:
Code
(?<=\<title\>)[a-zA-Z0-9-&\|\s]*(?=\</title\>)
Thread: Backend Web-Dev. - by SomeWhiteGuy

WATCH OUT 'LIL HOE,
MY PARTNA STILL SMOKE ON PAROLE
selling -
megabits.org + freakin.pro
(Oct 15, 2012 08:42 PM)SomeWhiteGuy Wrote:  You are correct, and I didn't really think about that.

Easy work-around:
Code
(?<=\<title\>)[a-zA-Z0-9-&\|\s]*(?=\</title\>)

Or you could do how I would have done it:

Code
siteTitle = GetBetween(siteSource, "<title>", "</title>", 0)

Private String GetBetween(ByVal source As String, ByVal str1 As String, ByVal str2 As String, ByVal index As Integer)
Dim tmp As String = Split(source, str1)(index + 1)
Return Split(tmp, str2)(index)
End Function

That way it returns any string no matter what is in it. 😉
(Oct 15, 2012 09:13 PM)Banksу Wrote:  Or you could do how I would have done it:

Code
siteTitle = GetBetween(siteSource, "<title>", "</title>", 0)

Private String GetBetween(ByVal source As String, ByVal str1 As String, ByVal str2 As String, ByVal index As Integer)
Dim tmp As String = Split(source, str1)(index + 1)
Return Split(tmp, str2)(index)
End Function

That way it returns any string no matter what is in it. 😉

That works too. Thanks for the function! 🙂
Thread: Backend Web-Dev. - by SomeWhiteGuy

WATCH OUT 'LIL HOE,
MY PARTNA STILL SMOKE ON PAROLE
selling -
megabits.org + freakin.pro
I would have used <title>(.*)</title> that will match anything and since there is only one title tag its asll good :)

[Image: HJdK32K_x]
lensert.com is the new screenshot utility, try it out now!
OSX & WINDOWS

or you try this (?<=\<title\>)(.*)(?=\</title\>)
Thanks everyone for the compliments and improved RegEx patterns.
Thread: Backend Web-Dev. - by SomeWhiteGuy

WATCH OUT 'LIL HOE,
MY PARTNA STILL SMOKE ON PAROLE
selling -
megabits.org + freakin.pro
(Oct 16, 2012 06:07 AM)-SiR- Wrote:  or you try this (?<=\<title\>)(.*)(?=\</title\>)
Exactly, with making the match non-greedy and no reason to capture that title: (?<=\<title\>).*?(?=\</title\>)

Also, no need of using a loop:
[img]http://rapidimg.org/server/files/507dcedc9551dVGy9IO.png[/img]

siteTitle = regex.Match(siteSource).Value will work good which will return first matched value.
(Oct 16, 2012 08:48 AM)soft2050 Wrote:  Exactly, with making the match non-greedy and no reason to capture that title: (?<=\<title\>).*?(?=\</title\>)

Also, no need of using a loop:
[img]http://rapidimg.org/server/files/507dcedc9551dVGy9IO.png[/img]

siteTitle = regex.Match(siteSource).Value will work good which will return first matched value.

You are correct. Considering there will only be one match. I'm just so used to doing that, lol. o_o
Thread: Backend Web-Dev. - by SomeWhiteGuy

WATCH OUT 'LIL HOE,
MY PARTNA STILL SMOKE ON PAROLE
selling -
megabits.org + freakin.pro


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by FarosMolokoNov 2, 2018 02:28 PM 4 176 Nov 2, 2018 02:28 PM
Last Post: He B TeMy
[.NET] by Johan CruyffJun 14, 2017 09:41 AM 5 206 Jun 14, 2017 09:41 AM
Last Post: Johan Cruyff
[.NET] by pap.iOct 7, 2016 09:56 PM 10 278 Oct 7, 2016 09:56 PM
Last Post: deiski