Using my text editor, Sublime 2, I want to search for code that has unauthorized warnings. So I need a regular expression that finds "alert" but not "// alert" or "// alert". I do not know how to invert and then combine the two results. Sublime Text uses Boost syntax for regular expressions. Thanks for any help.
You can search for text not preceding // in this way
//
(?<!\/\/\s?)alert
EDIT: If the editor does not support lookbehinds variables, you must specify all the features in different lookbehinds
(?<!\/\/\s)(?<!\/\/)alert
try the following:
(?<!//)(?<!// )alert
Boost syntax is based on Pearl RegExp. Thus, a negative lookbehind (?<!text) must be supported. In this example, I use negative lookbehind twice (with and without space) because the lookbehind text must be a fixed length.
(?<!text)
You can learn more about the lookaround function in RegExp:http://www.regular-expressions.info/lookaround.html
Source: https://habr.com/ru/post/1436553/More articles:Are file descriptors in perl global? - perlMove invariant check error message to field in Plone - pythonEllipsize does not work for textview inside table row - androidRotate in ImageView, inside RelativeLayout - androidEntity Framework Insert object with related object - c # -4.0Pass SSIS variable to Process Process - sqlRadish vs Cassandra (Bigtable Data Model) - cassandrato delete the tab with documents specified in avalondok - avalondockiOS 6: Editing and Autoresizing UITableView - iosSSIS 2012 Passing a parameter to a packet using CATALOG.start_execution - parametersAll Articles