obsidian-latex-suite icon indicating copy to clipboard operation
obsidian-latex-suite copied to clipboard

[FEATURE] Uncaptured group replaced with empty string in Regex

Open Cluster-YW opened this issue 4 months ago • 0 comments

Under normal circumstances, this snippet should replace both 1234-56-78 and 56/78/1234 with 78561234 .

    {
        trigger: "(\\d{4})-(\\d{2})-(\\d{2})|(\\d{2})/(\\d{2})/(\\d{4})",
        replacement: "[[2]][[1]][[0]][[4]][[3]][[5]]", options: "rtA"
    }

But in fact it outputs 78561234undefinedundefinedundefined and undefinedundefinedundefined78561234

I think having an uncaptured group return an empty string instead of undefined solves this

Cluster-YW avatar Feb 27 '24 06:02 Cluster-YW