- AuthorPosts
- April 2, 2013 at 6:50 pm #10897thanksgodParticipant
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 hoursTracklist:
01 – Cool
02 – Hot
03 – Warm
04 – FireEnjoy my compilation,
Please, Give a thumb up.Deep Trance, 2012 – IN your head, blah blah blah
Duration: Until the world endsTracklist:
01 – Start
02 – StopEnjoy my compilation,
Please, Give a thumb up.Deep House, 2020 – Super cool, blah blah blah
Duration: 100 hoursTracklist:
01 – Hot
02 – Shaking
03 – Snow
04 – Raining
05 – Fire
06 – Lovely HomeEnjoy 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
April 3, 2013 at 4:30 am #10898thanksgodParticipantanyone? please >_<
BTW, does Emeditor has “dotall” regex?
April 3, 2013 at 5:23 am #10899StefanParticipant.
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
.April 3, 2013 at 6:02 am #10900thanksgodParticipantHi, Stefan
First of all, you help me again, thank you so much >_< Also thank you for letting me know about
“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 :-) :-)
April 3, 2013 at 6:39 am #10901StefanParticipantHi,
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..
April 3, 2013 at 7:41 am #10903thanksgodParticipantHi,
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!!!!
April 3, 2013 at 8:25 am #10904StefanParticipantbtw
the easter egg of EmEditor is Tools > All Commands…
:-D
- AuthorPosts
- You must be logged in to reply to this topic.