No3371/obsidian-regex-pipeline

regex pipeline doesn't working correctly

Closed this issue · 1 comments

Issue description

In obsidian regex pipeline plug-in, overwriting regex flags manually doesn't works properly. giving multiple flags will either show applied 0 regex replacement or will show applied 1 regex replacement without actually replacing anything. for example when using 'line break with br tag' regex ruleset, it replaces all line breaks with br tag including line breaks from inside of code block. and there is no option to find a match and find sub matches from that match and replace those sub matches ('SEARCH' --> 'SEARCH' --> 'REPLACE'), nor a option to disable regex from replacing inside of code blocks.

Steps to reproduce the issue

  1. try this regex pattern "."gms->"1" and you will see it doesn't changes anything at all. and even just giving single s flag will not work as expected as it doesn't even replaces the newline characters. but after removing all the flags it will work correctly. and character escape (like \n \t) doesn't even work inside the 'REPLACE', thus having no choice, had to use back reference

What's the expected result?

  • after matching the whole code block, i used lookaround with capturing group to capture all the br tag inside the code block. but inside of lookaround making quantifier lazy with ? quantifier somehow breaks the regex pattern, but works correctly in the regex101 site. thus can't replaces all the br tags with new line character

What's the actual result?

  • if regex worked correctly it would had replaced all the br tag from inside the code block back to the new line character

Additional details / screenshot

regex problem

Thanks for pointing out 😄
Fixed in e3c7075.
1.0.9 is released for this fix, update is available now.