This regular expression will help you to match comments in TSQL code.
Single line comments (--) and multiline (/**/) are supported. Multiline comments can be nested one into another. Only one level of nesting is supported.
Inspired by http://stackoverflow.com/a/7690874/1012986
Single line comments (--) and multiline (/**/) are supported. Multiline comments can be nested one into another. Only one level of nesting is supported.
/\*(?>(?:(?!\*/|/\*).)*)(?>(?:/\*(?>(?:(?!\*/|/\*).)*)\*/(?>(?:(?!\*/|/\*).)*))*).*?\*/|--.*?\r?[\n]|--.*?$We used this regular expression to remove all comments from TSQL before analysis.
Inspired by http://stackoverflow.com/a/7690874/1012986
No comments:
Post a Comment