So after you bumped, & I read it again, & I think "how to 'see' or 'create' spaces at the end", & I sort of got fixated on it, & I think, oh, I'll think about it, later.
And then I came back, again, & actually look at what I wrote before.
And it hits me, if the earlier was OK, then would this too be OK?
Ending spaces or dots:
1:RegEx
- Code: Select all
Match: (.*?)( +$|\.+$)
Replace: \1
(No time at the moment to test or think more about it...)
- Code: Select all
C:\out\Bug Bug\X>dir > " abc123 .txt"
C:\out\Bug Bug\X>dir > " abc123 "
C:\out\Bug Bug\X>
I haven't verified that the second example does actually "have" spaces at it's end or not?
But the first does.
So " abc123 .txt" does work.
Suppose, Match: (.*?)(\s+$|\.+$) might be a little
clearer.
" abc123 " (if that is in fact what it is) is not changed, so guessing it is not " abc123 " but rather " abc123"?
(So much for not having time
.)
- Code: Select all
C:\out\Bug Bug\X>dir > " abc123....txt"
And that too works, resulting in abc123.txt.
And in that respect, the fact that they are spaces or dots is really immaterial too (just makes it harder to visualize).
It could just be any beginning or ending char that you wanted to get rid of.
No different from, Match: (^X+|^\.+)(.*) to remove opening X's (or dots).
"XXXabc123.txt" -> "abc123.txt"
(Now I
do have to go
.)