Remove Repeated Words and Symbols
-
{ } =spaceI would like to replace these characters with an underscore, and then remove all the duplicate words.
For instance, I’d like to change:
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.)
dmg_sm0993_event_summonedtable_0039_damage_hit_defend_fail_se_type_slash_low -
Hello, @kloruklass and All,
Given your ( uniq ! ) example :
dmg_sm0993_event (summonedtable) 0039-event [damage=hit_defend_fail_se_0039_type=slash_low] [damage_fail_type=defend_fail] {!} {r} {m} {s} {e}With the following regex S/R :
-
SEARCH
(?-s)[^\w{}\r\n]+(?:\x20*({.+?})|) -
REPLACE
?1:_ -
Tick the
Wrap aroundoption -
Select the
Regular expressionsearch mode -
Click once, on the
Replace Allbutton
You’ll get this temporary text :
dmg_sm0993_event_summonedtable_0039_event_damage_hit_defend_fail_se_0039_type_slash_low_damage_fail_type_defend_fail
Now, using this second regex S/R :
-
SEARCH
(?i-s)(([a-z0-9]+)_.*)_\2(?:(_)|\R|\z) -
REPLACE
\1?3_ -
Click on the
Replace Allbutton, several times, till you see the status line0 occurrences were replaced in entire file( IMPORTANT )
And you’ll get the expected text :
dmg_sm0993_event_summonedtable_0039_damage_hit_defend_fail_se_type_slash_lowBest Regards
guy038
-