[ZBXNEXT-4452] Edit macro variables values extracted from web page in successive POST request using function "replace(<what>,<to_what>)" Created: 2018 Mar 29  Updated: 2022 Sep 07

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: None
Affects Version/s: 3.4.8rc1
Fix Version/s: None

Type: New Feature Request Priority: Trivial
Reporter: Oleg Banin Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: macros
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Edit macro variables values extracted from web page in successive POST request using function "replace(<what>,<to_what>)"
It can be realized like already existing urlencode/urldecode ({{macro}.urlencode()}) :{{macro}.replace(<what_sub_str>,<to_what_sub_str>)}

Example:
=====
POST request #1 returned the following text (JSON):
--------

{"var":"someurlpart\/someurlpart\/someurlpart\/someurlpart\/"}

---------
We define macro variable

{SOMEVAR} and extract using regexp the follwing value: "someurlpart\/someurlpart\/someurlpart\/someurlpart\/" (without quotes).
In second web step we need to use value of {SOMEVAR}

as "someurlpart/someurlpart/someurlpart/someurlpart/". Now it can't be archived, but with implementation of "replace(<>,<>)" function it could be easily done by {{SOMEVAR}.replace("
","")}
=====



 Comments   
Comment by Oleg Banin [ 2018 Mar 29 ]

Jira formatting lost <backslash>. Correct:

<...>Now it can't be archived, but with implementation of "replace(<>,<>)" function it could be easily done by {{SOMEVAR}.replace("\\","")}
=====
Comment by Renato Lima [ 2022 Sep 07 ]

It would be better to allow regex replace like `regrepl(<>, <>)`

Generated at Thu Apr 25 06:36:23 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.