replace using regex

Tags:

#1 Sajeshvv23

Hi,

i have below replace function for replacing "|0" to "Zero".

Exec $Message = replace($Message, "|0 ", "Zero");

now, i want to replace "|0" to "|15" with Zero.

do i need to add 15 more Exec replace function, or is there is any way to replace using single exec using regex?

#2 NenadMDeactivated Nxlog ✓
#1 Sajeshvv23
Hi, i have below replace function for replacing "|0" to "Zero". Exec $Message = replace($Message, "|0 ", "Zero"); now, i want to replace "|0" to "|15" with Zero. do i need to add 15 more Exec replace function, or is there is any way to replace using single exec using regex?

Hello Could you please elaborate: I want to replace "|0" to "|15" with Zero. Do you want to replace XYZ-|0-ABCD and XYZ-|1-ABCD ... and XYZ-|15-ABCD with XYZ-Zero-ABCD? Or is it something else. Please share an example.

If my assumption is right above, please try the following:

Exec $Message = replace($Message, "|[0-9]+", "Zero");