Page 1 of 1

Can someone help me with some RegEx for WildEdit?

Posted: Fri Jan 20, 2006 10:07 pm
by kjustian
I need to search for the following formats of strings

C_OP700_Panelview_424
C_OP700_Panelview_00
C_OP700_Panelview_10_00
C_OP700_Panelview_06_10
C_OP700_Panelview_32
C_OP700_Panelview_10_11
C_OP700_Panelview_500
C_System_Panelview_424
C_System_Panelview_00
C_System_Panelview_10_00
C_System_Panelview_06_10
C_System_Panelview_32
C_System_Panelview_10_11
C_System_Panelview_500

and then modify them to this ...

{[PLC_05052]C_OP1300_Panelview[424]}
{[PLC_05052]C_OP1300_Panelview[0]}
{[PLC_05052]C_OP1300_Panelview[10].0}
{[PLC_05052]C_OP1300_Panelview[6].10}
{[PLC_05052]C_OP1300_Panelview[32]}
{[PLC_05052]C_OP1300_Panelview[10].11}
{[PLC_05052]C_OP1300_Panelview[500]}
{[PLC_05052]C_System_Panelview[424]}
{[PLC_05052]C_System_Panelview[0]}
{[PLC_05052]C_System_Panelview[10].0}
{[PLC_05052]C_System_Panelview[6].10}
{[PLC_05052]C_System_Panelview[32]}
{[PLC_05052]C_System_Panelview[10].11}
{[PLC_05052]C_System_Panelview[500]}

Note the hard part (for me) to figure out is the search backwards
and especially the extensive use of reserved characters in the
modified strings. Then to make it a little more complicated, the
zero padding must be removed as well. Anybody up for a challenge?

Posted: Sat Jan 21, 2006 10:57 am
by ben_josephs
Here's one way, in four steps:

Fix the OP700_Panelviews:
Find what:
C_OP700_Panelview_([0-9]+)
Replace with:
{[PLC_05052]C_OP1300_Panelview[$1]}
Fix the System_Panelviews:
Find what:
C_System_Panelview_([0-9]+)
Replace with:
{[PLC_05052]C_System_Panelview[$1]}
Fix the second trailing numbers:
Find what:
\}_([0-9]+)
Replace with:
.$1}
Fix the leading zeros:
Find what:
([\[.])0+([0-9])
Replace with:
$1$2