"([ \t\n])+?" just isn't right. I want to indicate at the beginning
and ending of each note, there should be a whitespace delimiter,
either a newline, a tab or a space. But I cannot use "^" or "$"
because then, the "e8" in a line like "c1 f4. e8 g2" wouldn't match. I
tried a few different variations, and none of them satisfied me
completely. When I sent the message, I forgot to remove the "?" from
that one... I think. I want at least one delimiter before the letter
name. Different variations of this ended up skipping different valid
matches. I just gave up and said "it's close enough".
There are other problems as well: If your string of notes includes
lots of stuff like
c2\fermata | f2 | g2^"CHORUS"
the regex is going to make a mess of it.
Some of that can be fixed with the NOT modifier ^ For example
"([^a-z0-9])+" would mean at least one non-alphanumeric character. And
then there are the other backslash combinations which cover groups of
characters and idioms like "word" or "non-word". Those would probably
fix A LOT of the problems. I just always have to look them up and was
feeling lazy, but if you dig deep into the last link I provided, that
covers all the arcane, occult ins and outs of the Python regex
processor, you can probably construct the perfect regex before you
die, but I'm guessing you'd rather write music. ;-)
Well you guys, now you are going too fast for me. Too many \this and |that at one time.
And how to ever remember this all.
This thought brings me to the following:
“Can you help me to transform this into a snippet for the Frescobaldi menu?”
Then I can use it fast when needed. And because all is in the script of the snippet is much easier then remembering, and easier to do some quick modifications (and or) make a copy for another regular search/replace task?
BTW: Is there anywhere on the internet an archive with snippets people have made, for the use and benefit of us all?
Regards, Eef
--
Frescobaldi homepage: http://www.frescobaldi.org/
Mailing list: http://groups.google.com/group/frescobaldi
Issue tracker: https://github.com/frescobaldi/frescobaldi/issues
---
You received this message because you are subscribed to the Google Groups "Frescobaldi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to frescobaldi...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/frescobaldi/CA%2BpvXReZA1txtXyVXsqPkK449JJaArXif%3DZ-yhT33%3Dmu5YG80Q%40mail.gmail.com.
Well you guys, now you are going too fast for me. Too many \this and |that at one time.
And how to ever remember this all.
This thought brings me to the following:
“Can you help me to transform this into a snippet for the Frescobaldi menu?”
Then I can use it fast when needed. And because all is in the script of the snippet is much easier then remembering, and easier to do some quick modifications (and or) make a copy for another regular search/replace task?
BTW: Is there anywhere on the internet an archive with snippets people have made, for the use and benefit of us all?
And for Frescobaldi? Maybe also?
This thought brings me to the following:
“Can you help me to transform this into a snippet for the Frescobaldi menu?
I'm not sure a snippet is going to be helpful, since this is a search and replace, but maybe someone knows how to do that.
---------------------------
Well, as an example: I use an app on my iPhone, what is very well in reading music. It exports the results however as a messy Musicxml. After import in Frescobaldi I have to do a lot of search and replacement to get nice looking strings to be used in my arrangements
etc. A snippet with all actions I have to do, would make this more then a bit easier.
And yes it is possible. I did some searching, and with trial and error, this is a simple example to find and remove barchecks at end of the line:
-*- python;
import re
text =(re.sub('\| % \w*|\\barNumberCheck \#\w*','',text))
-------------------------
* the regex module is imported
* re.sub has three inputparts:
Regards, Eef
Then I can use it fast when needed. And because all is in the script of the snippet is much easier then remembering, and easier to do some quick modifications (and or) make a copy for another regular search/replace task?
BTW: Is there anywhere on the internet an archive with snippets people have made, for the use and benefit of us all?
Well, there's this for LilyPond:
--
Knute Snortum
--
Frescobaldi homepage: http://www.frescobaldi.org/
Mailing list: http://groups.google.com/group/frescobaldi
Issue tracker: https://github.com/frescobaldi/frescobaldi/issues
---
You received this message because you are subscribed to the Google Groups "Frescobaldi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
frescobaldi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/frescobaldi/CALmeJxTXf5bKPK31sgZQL9z2gAzYQFX-bdyXJ%3D%3DYxNZ9_OYUvQ%40mail.gmail.com.