Reputation: 1080
Given console log output such as:
...
app.js:4408 update w/ model.location: Discovering
app.js:4408 update w/ action: Animate 911583 { width = 320, height = 480 }
app.js:4408 update w/ model.location: Discovering
app.js:4408 update w/ action: Animate 911609 { width = 320, height = 480 }
app.js:4922 some other log message
app.js:1923 yet another thing on the console
...
Is it possible to get Chrome to remove all lines that include the word "Animate"?
I've tried using a negative lookahead like: .*(?!Animate).*
(see also: How to negate specific word in regex?) in Chrome, with no luck.
The regex has been tested at regexpal:
But it has no effect in Chrome:
Being able to just type "!Animate" or "Animate" [x] negate filter would be great. Is that possible, or can anyone get a negate regex to work in this situation?
Thanks.
Upvotes: 21
Views: 5138
Reputation: 965
Since chrome 62 you can use negative filters in dev tools.
In the console filter box enter:
-<textToFilter>
I.e: To remove entries with text "Animate" just type:
-Animate
More info:
https://developers.google.com/web/updates/2017/08/devtools-release-notes#negative-filters
Upvotes: 47
Reputation: 23958
You can use this to filter out any result that contains the Animate
string at any point in main string:
^((?!Animate).)*$
^
- Start of string(?!Animate)
- Negative lookahead (at this cursor, do not match the next bit, without capturing).
- Match any character (except line breaks)()*
- 0 or more of the preceding group$
- End of stringNegative lookahead is currently broken in the Network panel, but fine in the Console panel. I discovered the issue when I was answering this question recently. I pushed a fix, awaiting review.
Upvotes: 2