Page 1 of 1

Can someone help me with some RegEx?

Posted: Fri Jan 20, 2006 11:25 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: Fri Jan 20, 2006 11:41 pm
by Abacre
Hi,

You should put 4 pairs into the batch grid:
1.
Search for:
(C_\w*)_Panelview_00
Replace with:
$1_Panelview_0

(it will remove first position zero padding)

2.
Search for:
(C_\w*)_Panelview_(\d+)_00
Replace with:
$1_Panelview_$2_0

(it will remove second position zero padding)

3.
Search for:
(C_\w*)_Panelview_(\d+)
Replace with:
{[PLC_05052]$1_Panelview[$2]}

(for conversion string having one number)

4.
Search for:
(C_\w*)_Panelview_(\d+)_(\d+)
Replace with:
{[PLC_05052]$1_Panelview[$2].$3}

(for conversion string having two numbers)


So put 4 pairs into the batch grid and run it.

Wow thanks for the quick reply!

Posted: Fri Jan 20, 2006 11:45 pm
by kjustian
This is excellent service (BTW I just bought this program!)
Thanks again!!!

Posted: Fri Jan 20, 2006 11:46 pm
by Abacre
Thank you!