Got more questions? Find advice on: ASP | SQL | XML | Windows
Welcome to RegexAdvice Sign in | Join | Help

Need help with zero or once matches

  •  02-26-2008, 8:17 AM

    Need help with zero or once matches

    Urls:
     "~/Home/Partner/OnBoard/Cabin/default.aspx"
    "~/Home/Partner/OnBoard/Cabin/default.aspx?param=2"

    regex:
    (~/[Hh]ome/[Pp]artner/[Oo]nboard/)(.*)(/.+\..+)(\?)(.*)


    current matches:
     "~/Home/Partner/OnBoard/Cabin/default.aspx"
    None

    "~/Home/Partner/OnBoard/Cabin/default.aspx?param=2"
    1: ~/Home/Partner/OnBoard/
    2: Cabin
    3: /default.aspx
    4: ?
    5: param=2

    wish:
     "~/Home/Partner/OnBoard/Cabin/default.aspx"
    5 matches where match 4 and 5 is null

    "~/Home/Partner/OnBoard/Cabin/default.aspx?param=2"
    As it is.



    I could just use 2 regex but I don't like that solution.

    Kin regards
    Bkr




     

     

View Complete Thread