DraqueT / PolyGlot

PolyGlot is a conlang construction toolkit.
MIT License
389 stars 44 forks source link

[Bug] Evolve Language replacement field #1161

Closed Tony2987 closed 2 years ago

Tony2987 commented 2 years ago

Evolve Language replacement field is not interpretating regex, instead outputs regex commands as characters.

Example: Target pattern: [aeiou]t[aeiou] Replacement: .d.

Expected result: ato -> ado atro -> atro

Actual result: ato -> .d. atro -> atro

PolyGlot ver. 3.5.1 Build Date: 2022-02-19 23:34 Windows version.

DraqueT commented 2 years ago

Thank you for reporting this! I'll give it a look as soon as I'm able and link you to a beta where it's corrected as soon as it exists.

Tony2987 commented 2 years ago

Just as a heads up, the main issue in my example was an improper regex for detection. However, I still couldn't make regex work on the replacement. I suppose this could still be my incompetence, but I think it's worth taking a look.

DraqueT commented 2 years ago

Heyo! I found the issue! What you're looking to do here requires a tricky regex pattern. Here's what the pattern and replacement should look like:

Pattern: (?<=[aeiou])t(?=[aeiou]) Replacement: d

The pattern uses lookahead and lookbehind to match text based on what comes before and after, but does not match those before and after values themselves (so they are not replaced). Hope this helps! I'm closing the ticket, but feel free to open again if you have more trouble. :3