Allow to filter console by regular expression
Categories
(DevTools :: Console, enhancement, P3)
Tracking
(firefox60 wontfix, firefox68 fixed)
People
(Reporter: sebo, Assigned: hemakshis)
References
(Blocks 2 open bugs)
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
Reporter | ||
Updated•7 years ago
|
Reporter | ||
Updated•7 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Comment 1•6 years ago
|
||
Hi Nicolas,
I would like to take up this issue, could it be assigned to me?
Thanks
Hemakshi
Comment 2•6 years ago
|
||
Hello Hemakshi, thanks for wanting to help us and sorry for the delay.
I'm assigning you the bug.
The main function responsible for the text filtering is in devtools/client/webconsole/reducers/messages.js#794-825.
Let's try to do it as Sebastian pictured it: we should do a regex search if the filter text is of the following form /xyz/flags
(we should make sure flags are valid, so we don't confuse this with a path search, e.g. /src/test
)
Reporter | ||
Comment 3•6 years ago
|
||
(In reply to Nicolas Chevobbe from comment #2)
Let's try to do it as Sebastian pictured it: we should do a regex search if the filter text is of the following form
/xyz/flags
(we should make sure flags are valid, so we don't confuse this with a path search, e.g./src/test
)
Good point about paths searches. It needs to be ensured that searching by path is still possible. And there might be cases where the entered string is a valid regular expression but is meant to be a path search, a simple example is /path/
.
So the question is what to do in this case. Either do both, a normal text search and a regex search or somehow introduce an option to toggle regex search. Toggling might be implemented as a prefix regex:
similar to the filters within the Network Monitor.
Sebastian
Assignee | ||
Comment 4•6 years ago
|
||
(In reply to Sebastian Zartner [:sebo] from comment #3)
(In reply to Nicolas Chevobbe from comment #2)
Let's try to do it as Sebastian pictured it: we should do a regex search if the filter text is of the following form
/xyz/flags
(we should make sure flags are valid, so we don't confuse this with a path search, e.g./src/test
)Good point about paths searches. It needs to be ensured that searching by path is still possible. And there might be cases where the entered string is a valid regular expression but is meant to be a path search, a simple example is
/path/
.
In this case, both the strings matching the regex and the value "/path/" will be displayed. Suppose my file path looks like foo.bar/bug/123
. If a user enters as /bug/
in the input then it will match this URL and show this message. As bug
also seems to be a valid regular expression. I hope this is what Sebastian meant.
I tested this and it is working when implementing the method mentioned in comment #0 (i.e. by interpreting filter strings enclosed in slashes as regexes)
That isn't the case for all patterns though. For example, suppose the user searches for "/?path=/" hoping to search for the string "/?path=/", but since "?path=" isn't a a valid regex it doesn't work as expected.
Updated•6 years ago
|
Reporter | ||
Comment 6•6 years ago
|
||
The /path/
example was bad, because it matches in both cases, via a string and a regex search. Thayne gave a better example. So, /?path=/
should still match paths containing the string, even when the regex search fails in this case.
Sebastian
Assignee | ||
Comment 7•6 years ago
|
||
Any text enclosed between forward slashes is considered as a regex search. If the entered regex is invalid, a normal text search is performed.
Comment 9•6 years ago
|
||
bugherder |
Comment 10•5 years ago
|
||
I can't seem to find a regex search that provides results any different than a regular search. And all searches seem to be case insensitive. I need to be able to enter a regex string and get visibly different results than a standard search value. Can someone help me on this?
Comment 11•5 years ago
|
||
Hello Irene,
You can go to https://wary-soul.glitch.me/ , open the console, and filter with /(cool|rad)/
Comment 12•5 years ago
|
||
(In reply to Nicolas Chevobbe [:nchevobbe] from comment #11)
Hello Irene,
You can go to https://wary-soul.glitch.me/ , open the console, and filter with
/(cool|rad)/
Tried that. It worked in Nightly but not in Dev edition.
After discussion on slack, I've solved the problem. Thanks again Nicolas!
Updated•5 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Comment 13•5 years ago
|
||
Sorry, set this to dev-doc-complete by accident. I intended the edit for a different bug.
Comment 14•5 years ago
|
||
Added the following to the console page in the Filtering with Regular Expressions section:
You can also use a valid regular expression to filter the console output. For example, the following show video shows the results when filtering on two simple regular expressions: /(cool|rad)/ and /(cool)/.
{{EmbedYouTube("E6bGOe2fvW0")}}
Added:
You can filter content in the Web Console using regular expressions (bug 1441079).
Comment 16•5 years ago
|
||
Won't it be a good idea to allow regex filtering for the netmonitor searches as well ?
It is a feature I miss from Chrome.
Reporter | ||
Comment 17•5 years ago
|
||
Won't it be a good idea to allow regex filtering for the netmonitor searches as well ?
That's tracked in bug 1575577.
Sebastian
Description
•