Replies: 1 comment
-
What is the result you are getting. When I run your code in the repl I get the preferred text that you have indicated: $ d = "stations\":[[\"F4:B5:20:XX:YY:ZZ\",\"PC-TEST\"]]"
"stations\":[[\"F4:B5:20:XX:YY:ZZ\",\"PC-TEST\"]]"
$ replace(d, r'(?P<a>ZZ(.*?"){2})([a-zA-Z0-9_-]+)(?P<b>.*?"\])', "${a}ANONYMIZED${b}")
"stations\":[[\"F4:B5:20:XX:YY:ZZ\",\"ANONYMIZED\"]]" |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I tried to replace the name "PC-TEST in string for several days without luck
Orginal text:
"stations\":[[\"F4:B5:20:XX:YY:ZZ\",\"PC-TEST\"]]
Via the following code, ending with a square bracket "]" (?P.*?"])
replace(string!(.data.raw_data), r'(?P<a>ZZ(.*?"){2})([a-zA-Z0-9_-]+)(?P<b>.*?"\])', "$${a}ANONYMIZED$${b}")
Preferred text:
"stations\":[[\"f4:b5:20:XX:YY:ZZ\",\"ANONYMIZED\"]]
Without the closing ] bracket it will work but then it replaces some other text as well, how can i use a square bracket in this search?
Alse tried to replace the square bracket in the replace function with [[:punct:]] which will work but also replaces other text character?
Beta Was this translation helpful? Give feedback.
All reactions