none
How to get all names RRS feed

  • Question

  • <input type="checkbox" value="true" data-accounttype="steam" checked="">
    
    <input type="checkbox" value="true" data-accounttype="psn" checked="">
    
    <input type="checkbox" value="true" data-accounttype="xbox" checked="">
    
    <input type="checkbox" value="true" data-accounttype="bttle" checked="">
    
    
    How to get all names vb.net regex all 
    Dim s1s As String = Regex.Match(sty, "<input type=""checkbox"" value=""true"" data-accounttype=""(.*)"" checked />").Groups.Item(1).ToString

    Wednesday, November 21, 2018 1:57 PM

Answers

  • Hi,

    I tried your code,but make a little change.

    Imports System.Net
    Imports System.Text
    Imports System.Text.RegularExpressions
    
    Public Class Form1
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            ListView1.View = View.Details
            ListView1.Columns.Add("page")
            ListView1.Columns.Add("words")
            Dim wb As New WebClient
            Dim sr As String
            sr = wb.DownloadString("https://pastebin.com/raw/8zPJN4df")
            Dim regex As New Regex("<input type=""checkbox"" value=""true"" data-accounttype=""(.*)"" checked />")
            Dim matches As MatchCollection = regex.Matches(sr)
            For Each st1 As Match In matches
    
                Dim lt As ListViewItem = New ListViewItem
                lt.Text = st1.Groups.Item(0).Value
                lt.SubItems.Add(st1.Groups.Item(1).Value)
                ListView1.Items.Add(lt)
            Next
        End Sub
    End Class
    

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by XTOOLX Thursday, November 22, 2018 8:47 AM
    Thursday, November 22, 2018 2:09 AM

All replies

  • UP HELP ME 
    Wednesday, November 21, 2018 2:27 PM
  • UP HELP ME 

    Using "UP" in this forum is rude, if someone has something to offer then they will respond.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, November 21, 2018 3:51 PM
    Moderator
  • Seems like you are screen scrapping and I'm sure there is more to this than asked. 

    Learn HtmlAgility pack

    https://html-agility-pack.net/


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, November 21, 2018 3:53 PM
    Moderator
  • UP HELP ME 

    Using "UP" in this forum is rude, if someone has something to offer then they will respond.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    How to get names

    steam
    psn

    xbox

    bttle


    help me 
    Wednesday, November 21, 2018 4:13 PM
  • So I had time to do a simple demo

    Imports HtmlAgilityPack
    Public Class Form1
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Dim doc = New HtmlDocument()
            doc.LoadHtml("<input type='checkbox' name='ckb1' value = 'true' data - accounttype='steam' checked = '' > " &
                         "<input type='checkbox' name='ckb1'  value = 'true' data - accounttype='psn' checked = '' > " &
                         "<input type='checkbox' name='ckb3'  value = 'true' data - accounttype='xbox' checked = '' > " &
                         "<input type='checkbox' name='ckb4'  value = 'true' data - accounttype='bttle' checked = '' >")
    
            Dim divs = doc.DocumentNode.SelectNodes("//input[@type='checkbox']")
            '
            ' Here is a quickie which leaves you with ensuring the Attributes are always indexed correctly.
            '
            For Each item In divs
                Console.WriteLine($"'{item.Attributes(1).Value}' {item.Attributes(5).Value}")
            Next
        End Sub
    End Class
    

    Via the IDE local window


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, November 21, 2018 5:07 PM
    Moderator
  • I want to get the words inside the page by vb.net  The project I am working on vb.net And the words you set as an example because I want to get them out of the page
    Wednesday, November 21, 2018 6:15 PM
  • I want to get the words inside the page by vb.net  The project I am working on vb.net And the words you set as an example because I want to get them out of the page

    Well you have changed the requirements I see.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, November 21, 2018 6:47 PM
    Moderator

  •  Dim wb As New System.Net.WebClient
            Dim sr As String
            sr = wb.DownloadString("https: // pastebin. com/raw/8zPJN4df")
            Dim regex As New Regex("<input type=""checkbox"" value=""true"" data-accounttype=""(.*)"" checked />")
            Dim matches As MatchCollection = regex.Matches(sr)
            For Each st1 As Match In matches
    
                ListView1.Items.Add(New ListViewItem(st1.Groups.Item(0).Value, st1.Groups.Item(1).Value))
            Next

    I want to pull the words inside listview1 This clarification because I can not raise the pictures in the participation but I pumped my request from the first
    • Edited by XTOOLX Wednesday, November 21, 2018 7:33 PM
    Wednesday, November 21, 2018 7:29 PM

  • Well you have changed the requirements I see.


    I did not change the requests but I could not explain to you and this code will show you my order I want to get the words and put them inside listview1 This link is the source of the page and the words 
    1 = steam 

    2 = psn 

    Wednesday, November 21, 2018 7:46 PM
  • Hi,

    I tried your code,but make a little change.

    Imports System.Net
    Imports System.Text
    Imports System.Text.RegularExpressions
    
    Public Class Form1
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            ListView1.View = View.Details
            ListView1.Columns.Add("page")
            ListView1.Columns.Add("words")
            Dim wb As New WebClient
            Dim sr As String
            sr = wb.DownloadString("https://pastebin.com/raw/8zPJN4df")
            Dim regex As New Regex("<input type=""checkbox"" value=""true"" data-accounttype=""(.*)"" checked />")
            Dim matches As MatchCollection = regex.Matches(sr)
            For Each st1 As Match In matches
    
                Dim lt As ListViewItem = New ListViewItem
                lt.Text = st1.Groups.Item(0).Value
                lt.SubItems.Add(st1.Groups.Item(1).Value)
                ListView1.Items.Add(lt)
            Next
        End Sub
    End Class
    

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by XTOOLX Thursday, November 22, 2018 8:47 AM
    Thursday, November 22, 2018 2:09 AM
  • Hi,

    I tried your code,but make a little change.


    Imports System.Net
    Imports System.Text
    Imports System.Text.RegularExpressions
    
    Public Class Form1
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            ListView1.View = View.Details
            ListView1.Columns.Add("page")
            ListView1.Columns.Add("words")
            Dim wb As New WebClient
            Dim sr As String
            sr = wb.DownloadString("https:// pastebin .com/raw/8zPJN4df")
            Dim regex As New Regex("<input type=""checkbox"" value=""true"" data-accounttype=""(.*)"" checked />")
            Dim matches As MatchCollection = regex.Matches(sr)
            For Each st1 As Match In matches
    
                Dim lt As ListViewItem = New ListViewItem
                lt.Text = st1.Groups.Item(0).Value
                lt.SubItems.Add(st1.Groups.Item(1).Value)
                ListView1.Items.Add(lt)
            Next
        End Sub
    End Class

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thank you brother, how can I add them in front or both words together with some and separate them a piece
    • Edited by XTOOLX Thursday, November 22, 2018 8:51 AM
    Thursday, November 22, 2018 8:49 AM