Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #10897

    thanksgod
    Participant

    Hi,

    My problem is I want to delete OR extract those line (using bookmark) of course, between the KNOWN starting word, and KNOWN ending word. I mean each block I need, contain the same starting & ending words, however each block contain the different number of lines.

    for example,
    ——————————————————–
    Deep House, 2013 – So great, blah blah blah
    Duration: 50 hours

    Tracklist:
    01 – Cool
    02 – Hot
    03 – Warm
    04 – Fire

    Enjoy my compilation,
    Please, Give a thumb up.

    Deep Trance, 2012 – IN your head, blah blah blah
    Duration: Until the world ends

    Tracklist:
    01 – Start
    02 – Stop

    Enjoy my compilation,
    Please, Give a thumb up.

    Deep House, 2020 – Super cool, blah blah blah
    Duration: 100 hours

    Tracklist:
    01 – Hot
    02 – Shaking
    03 – Snow
    04 – Raining
    05 – Fire
    06 – Lovely Home

    Enjoy my compilation,
    Please, Give a thumb up.
    ——————————————————–

    As you can see each block has the same Start DEEP and End thumb up. word!!.

    However, each block has the different number of lines, so how can I use the regex to delete OR bookmark “EVERY words & lines” between those Starting & Ending words?

    I believe there is (are) better way(s) than using

    ^Deep(.*n)(.*n)(.*n)(.*n).*thumb up.

    whatever the numbers of (.*n) I need for each block, so if I have about 100 blocks and each block has different number of lines so that would be a real headache for me.

    I believe there must be some help of regex for the “UNKNOWN number of lines” to help me on this issue.

    So please anyone if you could help me on this issue, I would really appreciate it.

    Thank you so much

    #10898

    thanksgod
    Participant

    anyone? please >_<

    BTW, does Emeditor has “dotall” regex?

    #10899

    Stefan
    Participant

    .

    In the find dialog click at Customize…

    and enable “[X] Regular Expression can match new line characters”

    Than just RegEx search for “Deep.+thumb up.”

    If you have more then one of such block in the document, then
    search non-greedy “Deep.+?thumb up.” to select only one block at time.

    OR prefix your expression by “(?s)”
    “(?s)Deep.+?thumb up.”

    It’s like the JAVA pattern DOTALL
    to allow the dot to match newline characters, too.

    Or the perl single-line modifier ‘s’ which treats a string as single line.
    That is, change “.” to match any character whatsoever,
    even a newline, which normally it would not match.

    An other trick is to utilize [sS] to match any character:
    “Deep[sS]+?thumb up.”

    Read more at http://www.regular-expressions.info/reference.html
    .

    #10900

    thanksgod
    Participant

    Hi, Stefan

    First of all, you help me again, thank you so much >_ “enable “[X] Regular Expression can match new line characters”

    That’s REALLY useful for me in the future too.

    However, @ 1st, it doesn’t work, so I read further “Help” about that, and it says NOT to forget to specified the number in “Additional Lines to Search for Regular Expressions” text box to be more than ZERO. So I just enter “100”, and it banged it works like the pattern you gave me. Yes!!!

    For the (?s) & [sS] I found it about couple hours ago via stackoverflow
    And I believe many newbies like me doesn’t know that too, as you can see the number of the rating currently (138) lol that’s a lot.

    Also thank you for giving me not just one but more choices to solve my issue, and also for the future reference website too.

    BTW, I have one more question, for the ” Additional Lines to Search for Regular Expressions”, is it SAFE to enter the value very high (I mean 100 for example). I believe it should be ok while I’m using the Non-Greedy (?) mode, isn’t it?

    Thank you again Stefan for quick help 🙂 🙂

    #10901

    Stefan
    Participant

    Hi,

    you are welcome!

    >However, @ 1st, it doesn’t work,
    Yes i know, that’s called “learning by doing”.
    That way you will recognize it better rather
    then I had provided you to the whole solution.

    >is it SAFE to enter the value very high (I mean 100 for example).
    Yes it will be save, especially since you limited it
    by utilizing the non-greedy modifier.
    Only with even higher value on looong documents
    on older computers from the nineties this would
    be an issue i guess.

    .

    #10903

    thanksgod
    Participant

    Hi,

    Yeah, that’s a good way for me as a learner too. 🙂
    I like learning something new everyday as much as I can >_<

    And also thanks for letting me know about the safety value, yeah, my computer not that too old, so it should be fine. lol

    BTW, Since I’ve using EmEditor, I’ve found out from you and the Yukata that it provides most of the essential tools that suite for the beginner up to advanced or professional users.

    And EmEditor usually makes me very surprise that there are many tools that I need, but it hides somewhere (or maybe I don’t know that yet) just like easter egg in Microsoft or oldschool MSN. lol

    Thanks!!!!

    #10904

    Stefan
    Participant

     

    btw

    the easter egg of EmEditor is Tools > All Commands…

    😀

     

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

You must be logged in to reply to this topic.