Results 1 to 4 of 4

Thread: Reg Exp in VB

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    50

    Question

    Hi,

    I've just started out with regexp. Can anyone help me solve this, my first try with regexp.

    I need to get some data from an html-file. What I want to do is to find lines like the following:

    Code:
    <A HREF="http://db.afv.se/afv/owa/w3 page=Afv_Fond2&n=Fondid&v=2574">AMF Sverige</A>                       199,45 SEK<b>   199,45</b>  +14,9  14/11
    And get the result:

    Code:
    AMF Sverige;199,45;199,45;+14,9;14/11
    The syntax is the same for these lines but the links are different.

    Any great regexp programmers out there?

  2. #2

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    50

    Lightbulb I found it!

    After experimenting for a while I found it my self! Regular
    Expressions is something very powerful. If you ask a PERL-
    programmer he/she will say that that's a big lack if a
    language hasn't got that feature. I'm glad it's now
    possible to do these things in VB. I've hust started out
    but I do already understand the power in it. Well, it's a
    little bit more complicated in VB than in PERL, but PERL is
    also known as a language in wich you can do a lot in few
    lines of code.


    Regular Expressions is super for extracting information
    from a website for example. I wanted my application to
    fetch marketinformation for swedish mutal fonds from a
    website. It's easy to download the file but how do I get
    rid of all tags and only get the information I want.
    Regular Expressions does this very easy.

    This is the answer to my question:
    Code:
    <A.*>(.*)<\/A>\s+(.*)\sSEK<b>\s+(.*)<\/b>\s+(.*?)\s(.*)
    After that I've got to replace all spaces and stuff but then I get a perfect result!

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    50

    Question Other alternatives?

    It struck me... VB might have other alternatives? How do you people serch for a pattern? Is there other ways to solve my problem in a more VB-specific way??

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    50

    No response?

    Amazing that none of you have posted a reply on this subject? Quite a lot of views but no reply.

    Lot of you got a signature that tells us that you can C, C++, VB, Perl, COBOL etc. If some of you are real Perl-programmers you should get a temrature rise when you hear about RegExp!


    Aren't there anyone that uses RegExp in VB?? Or is it that all of you understand all about it or maybe no one understands what I'm talking about.

    Nice weekend!

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