Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #22956

    spiros
    Participant

    I have a Greek text with some English words and I want to filter the lines which begin with capital letter, how would I do that?
    For example, in Find/Replace I would do

    \n[Ά-Ώ,A-Z]

    with Match Case and Use Regular Expressions checked.
    but if I select Regex in the filter the \n bit does not work.

    #22957

    Patrick C
    Participant

    Provided I didn’t mess up, the following should do

    ^[Α-ΩA-Z].*$

    Where
    ^ start of string (i.e. line)
    followed by a character within [Α-ΩA-Z]
    followed by any character (except newlines) .
    occurring zero or more times *
    $ end of string (i.e. line)

    Let me know if it does or doesn’t work.

    Cheers

    Patrick

    PS The full syntax would be
    /^[Α-ΩA-Z].*$/gm

    #22959

    spiros
    Participant

    This did it for me

    ^[Α-ΩΆ-ΏA-Z]

    (I had to add “Ά-Ώ” so that it would get capitals with accents too)

    Is there a way to show the number of lines filtered?

    #22960

    Patrick C
    Participant

    Regarding the number of lines filtered:

    Option 1:
    Use the “Word Count” plugin (Tools → Plug-ins → 9 WordCount)
    Word count shows the total number of “Lines” and the “View Lines”, with the View Lines corresponding to the number of filtered lines.

    Option 2:
    Hit ctrl+a to select all.
    The status bar in the bottom right corner will then show the number of selected lines.

    #22961

    spiros
    Participant

    Option 1: Takes ages to load…
    Option 2: always shows the total number of lines for FULL file

    #22964

    Patrick C
    Participant

    As in the image:
    Option 2:
    Hit ctrl+a to select all lines, then the bottom right indicator shows the number of selected lines and the total number of lines.
    Option 2 is fast in my case. There is one downside that Option 2 does add the last line to the count if it is blank.

    Word count

    PS Regarding option 1:
    Yes, sadly sluggish performance is the case for large files.

    #22970

    spiros
    Participant

    I am working with a 500.000 lines file and Option 2 apparently works (in my case does not work at all, see screen) if “Word Count” plugin is active, which means… very slow performance. It was dead slow even with a 30.000 lines file.

    image

    #23016

    Yutaka Emura
    Keymaster

    Hi Patrick C,
    Regarding Option 2, I am not sure what you mean by “There is one downside that Option 2 does add the last line to the count if it is blank.”
    Can you please clarify this sentence?

    #23021

    Patrick C
    Participant

    Hello Yutaka

    I’ve now noticed, that word count does the same thing but the other way round.
    What I basically meant is as follows:

    Case where the last line is not blank:
    Last line not blank

    Results in ctrl-a finding 13+1 = 14 lines instead of 13; Word count finds 13 view lines
    An additional line found

    Case where the last line is blank:
    Last line blank

    Results in ctrl-a finding 13 lines; interestingly Word count finds 14 view lines
    13 lines found; 14 in case of word count

    #23025

    Yutaka Emura
    Keymaster

    I fixed the issue with the number of selected lines incorrectly displayed in the status bar and the Word Count plug-in.
    I also optimized the Word Count plug-in for speed, but if you need to speed up the plug-in, you might want to remove unnecessary queries such as Widths.
    Also, queries using regular expressions can take much longer time than others, so should be removed if unnecessary.
    Thanks,

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

You must be logged in to reply to this topic.