Can someone help me with some RegEx for WildEdit?

General questions about using WildEdit

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
kjustian
Posts: 1
Joined: Fri Jan 20, 2006 10:04 pm

Can someone help me with some RegEx for WildEdit?

Post 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?
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post 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
Post Reply