Artikash / Textractor

Extracts text from video games and visual novels. Highly extensible.
GNU General Public License v3.0
2.13k stars 205 forks source link

Can you make saved replacements not be so contextually sensitive to spaces? #1313

Open Uzukii opened 3 months ago

Uzukii commented 3 months ago

Pardon the language here, but this is an example of what my SavedReplacements.txt has to look like to make the dialog in most games not be so annoying.

|ORIG| penis |BECOMES| dick |END| |ORIG| penis'|BECOMES| dick'|END| |ORIG|Penis |BECOMES|Dick |END| |ORIG|Penis'|BECOMES|Dick'|END| |ORIG| cock |BECOMES| dick |END| |ORIG| cock'|BECOMES| dick'|END| |ORIG|Cock |BECOMES|Dick |END| |ORIG|Cock'|BECOMES|Dick'|END|

Is there a way to condense this so that I don't have to make so many variations? Because when you do it without spaces or commas for any given word, it also replaces whatever character comes before and/or after it. Basically coming out like this: "She sucked hisdickuntil he came." Why can't it be more like how Notepad++ or Ditto, where it knows to only replace the word itself and nothing else.

Blu3train commented 3 months ago

I couldn't manage the case preservation in the rule, but I had to make two separate rules. If there is someone more expert in regex syntax, maybe they can also manage the case preservation.

You need to use the "regex replacer" extension. In the SavedRegexReplacements.txt file insert the following lines

|REGEX|(Penis|Cook)([ '])|BECOMES|Dick$2|MODIFIER|g|END|
|REGEX| (penis|cook)([ '])|BECOMES| dick$2|MODIFIER|g|END|