Capitalisation Action

Came across this action and wondered if there a way to make this also change the file names in the same way as well as part of the same action?

[#0]
T=1
F=_TAG
1=1
2=

[#1]
T=4
F=_TAG
1=\\\\b(A|An|The|And|But|Or|So|After|Before|Out|When|While|Since|Until|Although|Even If|Because|About|Above|Across|Against|Along|Alongside|As|At|Below|By|During|For|From|In|Into|Of|Off|On|Onto|Over|Than|Through|Till|To|Under|Up|With|Within|Without)\\\\b
2=$lower($1)
3=0

[#2]
T=4
F=_TAG
1=^\\\\s*(\\\\w+)
2=$caps($1)
3=0

[#3]
T=4
F=_TAG
1=(\\\\w+)\\\\s*$
2=$caps($1)
3=0

Does this work correctly on tracks featuring time like AM or PM or ft (featuring)? I want to make sure AM & PM are always upper case and ft or feat are lower case. Same goes for the letters in 1st, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th, 9th, 10th and so on staying lower case.

Also, how do I stop it replacing normal brackets with square brackets and stop it changing the case from upper to lower for the first letter after an open bracket?

It is nearly impossible to achieve that.
No computer can see a difference for AM between
a) I AM the best
b) I see you at 9 AM

If the two letters ft or 4 letters feat are always surrounded by a space, then you can use an action to write them lower case (and avoid wrong lower case at the beginning of the title or as part of another word like left or feather)

see here on changing the case of filenames:


and here on how to sedt special characters as word boundary:

Thank you for your reply. Does it make a difference that AM or PM would always come after a number?

Also, not sure how to implement what you have described in your second paragraph as part of the existing script detailed above.

Would be just a litte bit better, because there are still cases like
c) Meeting at nine AM
But - of course - you can try to get solved 80% of your cases automatically and fix the other 20% manually.

I'm not sure where you got the above script. Maybe an export of several actions?
You can try to find an existing "regular expression" or "replace action" similar to this examples:


or

Nice point.
I found this article on A.M. and P.M. by the Washington University.
So it may be worth a try to get the correct spelling first (with dots inbetween) and then it should be easy to get the right case.
https://brians.wsu.edu/2016/05/16/am-pm/