kloruklass
New Member
- Joined
- Nov 18, 2021
- Messages
- 25
- Office Version
- 2021
- Platform
- Windows
I've always been using this VBA code so far: =RemoveDupes2(B1,"_")
Everything works great, but I was looking for a RegEx expression to use with a renamer like BRU Utility to save time.
Plus it's limited due to the "_" which is used to read words in between, so I'm forced to rename everything first adding the "_" everywhere.
While as you can see, I have lots of other characters: _ ( ) - [ ] { } = *space*
For instance, I'd like to change:
To (both "{}" and characters inside are not needed.)
VBA Code:
Function RemoveDupes2(txt As String, Optional delim As String = " ") As String
Dim x
'Updateby Extendoffice
With CreateObject("Scripting.Dictionary")
.CompareMode = vbTextCompare
For Each x In Split(txt, delim)
If Trim(x) <> "" And Not .exists(Trim(x)) Then .Add Trim(x), Nothing
Next
If .Count > 0 Then RemoveDupes2 = Join(.keys, delim)
End With
End Function
Everything works great, but I was looking for a RegEx expression to use with a renamer like BRU Utility to save time.
Plus it's limited due to the "_" which is used to read words in between, so I'm forced to rename everything first adding the "_" everywhere.
While as you can see, I have lots of other characters: _ ( ) - [ ] { } = *space*
For instance, I'd like to change:
Rich (BB code):
dmg_sm0993_event (summonedtable) 0039-event [damage=hit_defend_fail_se_0039_type=slash_low] [damage_fail_type=defend_fail] {!} {r} {m} {s} {e}
To (both "{}" and characters inside are not needed.)
Rich (BB code):
dmg_sm0993_event_summonedtable_0039_damage_hit_defend_fail_se_type_slash_low
Last edited: