Windows Vista Forums

can't get OR operator between two strings to work
  1. #1


    mike Guest

    can't get OR operator between two strings to work

    In the pattern below, I am trying to grab everything between the </
    span></h2> tags and [ <h2> OR <div class="footer"> ]

    preferably, if <h2> exists, it would match <h2>, if not, it would
    match <div class = "footer">



    pattern = "<\/span><\/h2>([\s,\S]*?)<h2>|<div class=""footer"">"

    How do I get the OR to work properly between <h2> and <div class =
    "footer"> ?

    Thanks for your help!

      My System SpecsSystem Spec

  2. #2


    Richard Mueller [MVP] Guest

    Re: can't get OR operator between two strings to work


    "mike" <mike_newsgroups@newsgroup> wrote in message
    news:627cb2fa-822f-4930-92cf-62e53706dc86@newsgroup

    > In the pattern below, I am trying to grab everything between the </
    > span></h2> tags and [ <h2> OR <div class="footer"> ]
    >
    > preferably, if <h2> exists, it would match <h2>, if not, it would
    > match <div class = "footer">
    >
    > pattern = "<\/span><\/h2>([\s,\S]*?)<h2>|<div class=""footer"">"
    >
    > How do I get the OR to work properly between <h2> and <div class =
    > "footer"> ?
    >
    > Thanks for your help!
    This seemed to work for me:

    pattern = "<\/span><\/h2>([\s,\S]*?)(<h2>|<div class=""footer"">)"

    The parentheses make it clear what is being OR'd.

    --
    Richard Mueller
    MVP Directory Services
    Hilltop Lab - http://www.rlmueller.net
    --



      My System SpecsSystem Spec

can't get OR operator between two strings to work problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
-ne operator Simon Walsh PowerShell 3 23 Nov 2008
Powershell Operator AdityaKir PowerShell 3 18 Aug 2008
-f operator Tibor Soos PowerShell 3 28 May 2008
What does the $() operator do? Kevin Buchan PowerShell 3 08 Feb 2008
Searching for strings in Vista using Windows Explorer doesn't seem to work Celegans Vista General 4 24 Jul 2007