I need to search for all my previous flag messages (both post and comment flags) where I had mentioned a thing "X". I would expect a UI where I can enter a search term and it would display all relevant terms. However, it is not there.

So, how do I do this?

1 Answer 1


Till the time this feature is officially implemented by SE, I made this short script (based off rene's related one) that searches your flags by the content of your flag message. You can specify a search regex, and the maximum number of pages to check too!

When the script finishes, it simply empties the current page and then replaces it with the contents of the search results.

// paste this in DevTools (F12)
// to be run on a https://SE_SITE.com/users/flag-summary/USER_ID page
// @name         Search flag summary by RegEx
// @version      1.0.0
// @author       GaurangTandon

(function() {
    var REGEX_TO_MATCH = /answer/,
        // set to -1 to check all pages
        MAX_PAGES_TO_CHECK = 3,
        matchedPosts = [],
        mainbar = $(document.getElementById("mainbar"));

    function finished(){
        console.log("finished processing all pages");

    // gets the page given by pagenumber
    function fetchPage(pageNumber) {
        if(MAX_PAGES_TO_CHECK != -1 && pageNumber > MAX_PAGES_TO_CHECK) return finished();

        // take the query parameter, create an array, remove the page parameter
        // this retains the users current setting (for `group` and `status`)
        var s = document.location.search.split('&').filter(query => query.indexOf("page") === -1);
        // next page to fetch
        s.push('page=' + pageNumber);

        // get the html
        $.get(document.location.pathname + s.join("&").replace(/^\&/, "?"), function(data) {
            var flaggedPosts = $(data).find(".flagged-post"), flagMsgText;

            // this is an empty page, we're done!
            if(flaggedPosts.length === 0) {                    
                return finished();

            flaggedPosts.each(function() {
                flagMsgText = Array.prototype.map.call(this.querySelectorAll(".revision-comment"), x => x.textContent);
                if(REGEX_TO_MATCH.test(flagMsgText)) {

            console.log("finished page " + pageNumber);

            // schedule the next fetch in 2000 ms
            setTimeout(fetchPage, 2000, pageNumber + 1);

    // start at page 1
    console.log("Listing flags:");

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .