Last active
February 16, 2023 03:10
-
-
Save trebron21/9222f676cf76cdc6fb0f to your computer and use it in GitHub Desktop.
Regex to search only between uncommented lines (NCLOC - Non-Comment Lines Of Code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Search only between uncommented lines (NCLOC - Non-Comment Lines Of Code): | |
First solution matches "keyWord" which is not commented with single line comment // | |
^*(?<!\/\/.*)keyWord // this uses negative lookbehind | |
or another solution without lookbehind for regex engines, that does not support it: | |
^[^//]*keyWord |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment