Results 1 to 3 of 3

Thread: REGex getting all file in a folder

  1. #1

    Thread Starter
    Addicted Member acidsnake's Avatar
    Join Date
    Feb 2008
    Posts
    157

    Post REGex getting all file in a folder

    Hi To all,

    I got problem using regex on how to download all text file in one folder


    im using this as my reference

    Dim RegexObj As New Regex("<*""(?<path>[^""]*txt)"">(?<fileName>[^.txt]+$)</A>")
    Dim MatchResults As Match = RegexObj.Match(htmlcontent)
    Dim matchCount = RegexObj.Matches(htmlcontent).Count
    Me.ProgressBar1.Maximum = matchCount

    here is the list i want to get

    here's the url of the items http://goo.gl/nL3dEk

    callcards_prod.txt
    cignal_pldt_meralco.txt
    gaming_prod.txt
    globe_eload_prod.txt
    internet_prod.txt
    other_prod.txt
    satellite_prod.txt
    smart_pldt_eload.txt
    sun_eload_prod.txt

    thank in advance
    Last edited by acidsnake; Sep 11th, 2015 at 04:01 AM.

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,371

    Re: REGex getting all file in a folder

    This RegEx example will give you all the anchor elements:
    Code:
    (<a href=".+\.txt">.*<\/a>)
    If you don't care for the elements and only want the innerHTML then give this a try:
    Code:
    (?<=<a href=".+\.txt">)(.*?)(?=<\/a>)
    Just remember to double up the quotation marks.
    Last edited by dday9; Sep 11th, 2015 at 04:08 PM. Reason: innerHTML not path
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    Addicted Member acidsnake's Avatar
    Join Date
    Feb 2008
    Posts
    157

    Re: REGex getting all file in a folder

    thanks dday9 hope it works

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width