Code: Select all
;Input
>param1 := { 1:"Test" , "Key {2": "" } , Param3 := [ {"t,e[a]s:t{b}": {1:"t,e[a]s:t{b}","t,e[a]s:t{b}": [4 ] }}]<
;this is the current result
>param1 .. --------------------------- , Param3 .. [ {--------------: ----------------------------------------}]<
;this is what I would like to achieve
>param1 .. --------------------------- , Param3 .. -------------------------------------------------------------<
Code: Select all
Text = param1 := { 1:"Test" , "Key {2": "" } , Param3 := [ {"t,e[a]s:t{b}": {1:"t,e[a]s:t{b}","t,e[a]s:t{b}": [4 ] }}]
MsgBox % ">" Text "<`n>" RemoveDefaultDefinitions(Text) "<"
ExitApp
RemoveDefaultDefinitions(Line){
static chars := [{"open":Chr(34),"close":Chr(34)} ; quote character
,{"open":"\[", "close":"]"}
,{"open":"\{", "close":"}"}
,{"open":":", "close":"="}]
CleanLine := Line
For k,q in chars
{
CleanLine := StrReplace(CleanLine, q.open . q.close , "..")
Pos := 1
Needle := q.open . "[^" q.open "]*?" . q.close
While Pos := RegExMatch(CleanLine, Needle, QuotedString, Pos){
ReplaceString =
Loop, % StrLen(QuotedString)
ReplaceString .= "-"
CleanLine := RegExReplace(CleanLine, Needle, ReplaceString, Count, 1, Pos)
}
}
Return CleanLine
}