New here: How do I...


#1

I looked at the ACTIONS shared by some users and I think one of them may(??) do what I want but the way the solution was presented makes no sense to me as to how to implement it.

Anyway, here's what I would like to do:

  1. Replace all occurrences of two or more contiguous spaces with only one.
  2. Given the following: MADONNA-^MATERIAL GIRL (where ^ is my representation of a blank space), change it to MADONNA^-^MATERIAL GIRL
  3. Conversely, given the following: MADONNA^-MATERIAL GIRL (where ^ is my representation of a blank space), change it to MADONNA^-^MATERIAL GIRL
  4. For requests 2 & 3 above, the end result is to always have the dash character with one leading and one trailing blank space

Can someone help this novice out with very specific instructions on how to do it?

Many thanks in advance...


#2

Use Replace with regular expression as action type:

Regular expression: \s{2,}
Replace matches with: " "

Regular expression: \s?-\s?
Replace matches with: " - "

(This would also turn MADONNA-MATERIAL GIRL into MADONNA^-^MATERIAL GIRL, if you don't want this, use (\s-|-\s) as expression)


#3

Thanks for your reply...

Your first expression worked great, the second did not.

I guess that what I'm looking for is for a way to place only one leading and only one trailing space when a dash is found no matter how many spaces or lack of spaces there are around that dash character.

Thanks once again!!!


#4

Try \s*-\s* as expression.


#5

It worked!!!

Thanks Dano...


#6

Dano,

I have another somewhat related question, why won't this expression work: Replace "_FILENAME": "^.mp3" -> ".mp3", where ^ represents a space?

I also tried selecting "only as whole word" and/or "case-sensitive comparrison"... also didn't work.

Thanks in advance for your time and efforts.


#7

I think in "Replace" the _FILENAME does not include the extension.

I wrote here how to do it with regular expressions.


#8

What more can I say than THANKS AGAIN!