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

Split SQL WHERE Clause

  •  03-20-2008, 9:58 PM

    Split SQL WHERE Clause

    I am pretty new to this Reg Exp stuff, but gaining more understanding every day.  My ASP application is attempting to Split a WHERE clause on the " AND "s, but having no luck.  I would also one day like to expand it to be able to split on " OR " but for now I settle with the baby step.

    Expression: (\w+)\s*([<>=]+)\s*([^AND$]+)
    Test Value: String='57846' AND Number=1 AND Date=#1/1/2008# AND Time=#1:34 PM# AND DATETIMED = #1/1/2008 1:34:25 PM# AND GTOE>=100 AND SpecialString='With Aposts And Spaces ''4'''

    The matches return:
    "String='57846' "
    "Number=1 "
    "Date=#1/1/2008# "
    "Time=#1:34 PM# "
    "DATETIMED = #1/1/2008 1:34:25 PM# "
    "GTOE>=100 "
    "SpecialString='With "

    All returns are great, except for the last, which I need to be:
    "SpecialString='With Aposts And Spaces ''4''"

    Thanks for the help,

    Jake

View Complete Thread