Regular Expressions ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • anony

    Regular Expressions ?

    Hi,

    I'm playing around with HTML pattern matching, and have a questions about
    parsing more than one line of text. If I want to parse multiple lines of
    text for a match, do I have to explicitly specify \n appearances in my
    expression (meaning I would have to know how many lines I'm dealing with
    ahead of time)? Seems like there's another way to do it. For example, say
    I want to capture a string beginning with <tr> and ending with </tr> that
    spans multiple lines in the HTML source. How do I tell it to include
    newlines in the search without doing \n.*\n.* etc.

    Thanks!
    Brian


  • Kevin Spencer

    #2
    Re: Regular Expressions ?

    Line Breaking characters (\r\n) are simply characters in a string. You see
    line breaks when displaying the string in NotePad or another text editor,
    because that is how they are supposed to look. Treat them as you would any
    other character. And BTW, the \s character class will match any white space
    character, including carriage returns and line feeds.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Big things are made up
    of lots of little things.

    "anony" <nosp@m.com> wrote in message
    news:wmDcc.4176 10$jH.6150091@t wister.tampabay .rr.com...[color=blue]
    > Hi,
    >
    > I'm playing around with HTML pattern matching, and have a questions about
    > parsing more than one line of text. If I want to parse multiple lines of
    > text for a match, do I have to explicitly specify \n appearances in my
    > expression (meaning I would have to know how many lines I'm dealing with
    > ahead of time)? Seems like there's another way to do it. For example,[/color]
    say[color=blue]
    > I want to capture a string beginning with <tr> and ending with </tr> that
    > spans multiple lines in the HTML source. How do I tell it to include
    > newlines in the search without doing \n.*\n.* etc.
    >
    > Thanks!
    > Brian
    >
    >[/color]


    Comment

    Working...