Results 1 to 4 of 4

Thread: [RESOLVED] Regular Expression Question

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2005
    Location
    Indiana
    Posts
    451

    Resolved [RESOLVED] Regular Expression Question

    I was wondering if someone could tell me how to match something even in a line break.

    I know that \w is any alpha numeric character, and . will do any character except linebreak.

    How can I match any character including a line break? I have been looking, but can't seem to find anything.

    Thank you for your help.
    Ben


    Using Visual Basic 2005/2008

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2005
    Location
    Indiana
    Posts
    451

    Re: Regular Expression Question

    Thank you techgnome, but that wasn't really helpful. I pretty much have that information.

    I am trying to get everything between body tags on an html page. When I use (?<=<body>).*?(?=</body>) on msn.com, for example, it works because everything is inline with no line breaks. However, if I use the sample below, that expression doesn't work. I am guessing it is because of the line breaks, but, even with multiline turned on, I have been unable to get the same results.

    Code:
    I couldn't past the text because it was too long. So I am attaching the text file.
    I have been working with Expresso to try to figure this out, but haven't been able to. Any help would be great.

    One thing I should add; the body tag has multiple settings, so I adjusted the expression to handle that. I can capture the first body tag, but can't get anything after that. This is what I have right now <(body[^>]+>(?=\w*\s*)</body>, but it doesn't work at all.
    Attached Files Attached Files
    Ben


    Using Visual Basic 2005/2008

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2005
    Location
    Indiana
    Posts
    451

    Re: Regular Expression Question

    Ok, I got this to work.

    (?<=<body[^>]*>).*?(?=</body>)

    Thank you for the help.
    Ben


    Using Visual Basic 2005/2008

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