Hey, yet again I seem to have a bit trouble with Mp3tag regex.
For example, field has something like this:
Dr. Test & A. B. C.
Now what I would like to do is remove spaces after dots, except for: dr. and vs. (and some others)
Hey, yet again I seem to have a bit trouble with Mp3tag regex.
For example, field has something like this:
Dr. Test & A. B. C.
Now what I would like to do is remove spaces after dots, except for: dr. and vs. (and some others)
You need to define what exactly do you mean with "and some others".
Regular expression works best if you can exactly define what you want to keep or what you want to remove.
Please add some real examples and the current and the future syntax.
In short, this is the regex, I am trying to use to match dot with space letters between single characters. According to regex101 it should work, but for some reason it does not seem to match in MP3tag
\b([a-z])(\.)\s
Action is currently for testing:
XX
Tried with action, $1$2 and $1$3 as well.
Example field was TITLE and contents were as follows (for testing)
Dr. Test A. V. C. blah blah
Basically, idea would be to remove space between single letters with dots like A. V. C. while keep everything else unchanged, like Dr. etc.
What I am struggling with is to remove that space, in case it is there.
Using MacOS version, in case it matters.
Also tried with different regex:
\b([a-z]\.\s)\b
It should match, for example A. and action $trim($1) which did not seem to work either.
I tried
$regexp('Dr. Test & A. B. C.',(.*?)(\u\.)\s+(.*?),$1$2)
which led to
Dr. Test & A.B.C.
Yes, but this is not universal, I am afraid. ![]()
It works for the supplied example.
You would have to replace the example string with the tag variable and try it.
OK will try, but not sure how it translates to action atm.
I think I may have discovered a bug @Florian
For example, when I spawn new action "Replace With Regular Expression" or duplicate existing one, it does not seem to work at all. No matter what I specify as Regex.
But when I modified existing one, replacing Regex and Replace with new values it worked.
Otherwise, this seems to work:
Regex: \b([a-z])\.\s(?!\w{2})\b
Replace: $trim($1.)
Try an action of the type "Format tag field" for the corresponding field
I do no thing that you can use scripting in the "replace" part - the action does not ask for a format string.
I have used such concept a lot in my actions and so far it has worked.
Please show such an example.
Thank you.
It works in different ways if you use the $regexp() or the "Replace with regular expression" function.
I just tested
in Convert>Tag-Tag
and it does not return a hit but the original string.

So what about the suggestion

This is because, when using a scripting function in the replacement part of the $regexp function, the scripting function is evaluated before the replacement occurs. This is due to the evaluation order of the scripting language.
The action Replace with Regular Expression supports scripting functions in the replacement part.
This won't work on macOS, because the underlying ICU regular expression engine does not support \u.
In my experiments, the Java 8 flavour on regex101 is the closest match to simulate the behaviour of ICU.
I don't know how to reproduce this. Are you creating a new action inside an existing action group?
Duplicated existing one, swapped out contents...and did not work.
Also replacement after -> does not show in global list for such activity.
Same happened when i spawned new one from scratch.
But, when I took random existing activity and swapped out contents there, it worked immediately.
I will experiment a bit more later and let you know, how reproducible this is and maybe provide some proper bug report.
And yes, it is a new action inside existing group.
Basically, I have one long list of actions in one group I run on newly purchased stuff, to "standardize" different fields to my liking.
It's working here, please provide (if possible) step-by-step instructions in case you can reproduce it.
Sure, will report back.