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

Need help with a regular expression for an sql join statement

Last post 05-11-2011, 8:55 PM by Aussie Susan. 3 replies.
Sort Posts: Previous Next
  •  05-10-2011, 6:16 AM 81989

    Need help with a regular expression for an sql join statement

    Can someone help me with a PHP regular expression to check the following condition at the beginning of a string:

    [LEFT [OUTER] | INNER]  JOIN where [] represents optional.

    something to match the following

    left outer join

    left join

    inner join

    join

     Thanks

    Filed under:
  •  05-11-2011, 12:38 AM 82001 in reply to 81989

    Re: Need help with a regular expression for an sql join statement

    Try:

    ^((left(\s+outer)|inner)\s+)?join\b

    Susan

  •  05-11-2011, 2:26 AM 82005 in reply to 82001

    Re: Need help with a regular expression for an sql join statement

    Thanks works great.

    With one small modification: 

    ((left(\s+outer)?|inner)\s+)?join\b

    Aussie?? are you an Australian?

  •  05-11-2011, 8:55 PM 82016 in reply to 82005

    Re: Need help with a regular expression for an sql join statement

    Sorry - I missed the '?' when I transcribed the pattern from the test platform.

    And yes - I am an Australian (now - originally a New Zealander)

    Susan

View as RSS news feed in XML