Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #10548

    user
    Participant

    hello!

    how can I return the number of found regex matches?

    how can I select the regex matches?

    thanks!

    #10549

    Yutaka Emura
    Keymaster

    Hello,

    Is this about macros?

    Thanks!

    #10930

    user
    Participant

    I am not sure

    I just want to have these options when I do a regex search

    is it possible?

    thanks!!!

    #10931

    Stefan
    Participant

    user wrote:
    count all the regex matches
    I just want to have these options when I do a regex search

    You can check “[X] Count Matches” and click at [Find Next]
    to see the count in the status bar.

    user wrote:
    select all the regex matches
    I just want to have these options when I do a regex search

    You can click at [Bookmark All]
    and then utilize “Edit > Bookmarks”

    Or use a script/macro to collect all matches.
    In the Library you can find e.g. “Macro to extract strings using regular expression”

    #10937

    Stefan
    Participant

    user wrote:
    hello!

    how can I return the number of found regex matches?

    how can I select the regex matches?

    thanks!

    One could utilize a macro like this basic example:

    //Text to parse for RegEx:
    selText = document.selection.text;

    //Show matches:
    vResults = findMatches(selText);
    alert(vResults);


    function findMatches(inputStr){
    //Build an expression to match what you want:
    //var regex = /dddd/ig; // match 2013
    var regex = /www..+?..{2,3}/ig; //match www.emeditor.com

    //To avoid errors, check beforehand if test is successful:
    if(regex.test(inputStr)){
    //if test was ok, collect matches:
    result= inputStr.match(regex);
    //some cosmetic:
    count = result.length;
    status = "Macro found " + count + " matches.";
    //return result to caller:
    return result.join("rn");
    }else{
    return "No match found.";
    }
    }

    _

    #10940

    user
    Participant

    it’s great, many thanks!

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Share with friends... Tweet about this on TwitterShare on FacebookShare on Google+Email this to someone