Hi,
In QM, what is the equivalent of the (\k<a>) regex, Or is there any other solution?
Powershell code:
Macro M1
In QM, what is the equivalent of the (\k<a>) regex, Or is there any other solution?
Powershell code:
$s = @'
str A=
Key 1
str Av=
Hello 1
World 1
Av.findreplace("[]" "┋")
str B=
Key 2
str Bv=
Hello 2
World 2
Bv.findreplace("[]" "┋")
str C=
Key 3
str Cv=
Hello 3
World 3
Cv.findreplace("[]" "┋")
str kv=
F
{A}={Av}
{B}={Bv}
{C}={Cv}
DynamicLV(kv)
'@
$s -replace '(?s)str (?<a>.)=\s*(.+)\s*str (\k<a>)v=\s*(.+)\s*(\k<a>)v\.findreplace\("\[\]" "┋"\)\s*', "`$1-`r`n`$3---`r`n" -replace '(?s)\s*---\s*str kv=.+|(?m)^ +'
Macro M1
out
_s=
;str A=
;;A Key
;str Av=
;;Hello 1
;;World 1
;Av.findreplace("[]" "┋")
;
;str B=
;;B Key
;str Bv=
;;Hello 2
;;
;;World 2
;Bv.findreplace("[]" "┋")
;
;str C=
;;C Key
;str Cv=
;;Hello 3
;;World 3
;Cv.findreplace("[]" "┋")
;
;str kv=
;F
;;{A}={Av}
;;{B}={Bv}
;;{C}={Cv}
;DynamicLV(kv)
_s.replacerx("(?s)str (?<a>.)=\s*(.+)\s*str (\k<a>)v=\s*(.+)\s*(\k<a>)v\.findreplace\(''\[\]'' ''┋''\)\s*","$1-\r\n$3---\r\n")
_s.replacerx("(?s)\s*---\s*str kv=.+|(?m)^ +","")
out _s