06-09-2014 12:34 AM
I have a text file like below (I copy 2 loop from the whole code) as you can see all these string and numbers are random. I want a code that can separate the blue part of the code for me in array.everything under { }; I used match pattern but its only get the first loop and not for the whole code.
BLOCK
{
ABCD_BSU2_TSET <BSU_ ORCAM _CED: 0x000> 32 KLC="hclk"
{
DER_KHU_1_0 7:6 NUM DEF=0x0 RW;
FRTY_1_RTGC 5 NUM DEF=0x0 RW;
FG_DERF_1_0 4:3 NUM DEF=0x0 RW;
K_DF_SWRD_DHDDI 2 NUM DEF=0x0 RW;
L_DFTF_SHDD_DH 1 NUM DEF=0x0 RW;
SHDDU 0 NUM DEF=0x1 RW;
};
ABCD_BSU_LLP <BSU_ORCAM_CED: 0x004> 32 KLC="hclk"
{
HDGDFD 7 NUM DEF=0x1 RW;
EDT_n 6 NUM DEF=0x1 RW;
HGD_l_SDR_5_0 5:0 NUM DEF=0x19 RW;
};
the rest of the code
.
.
.
}
06-09-2014 06:45 AM - edited 06-09-2014 06:46 AM
Put your Match Pattern inside of a While loop. Make it stop when the expression can't be matched (index will be -1). You will also need to keep track of the Index After Match in a shift register so that you don't repeatedly get the same set.
06-09-2014 12:10 PM
I have already tried that. but the loop does not take my 2D array input string. i tried to add 4loop but did not help. ....for regular expresstion are you using ; or {}; ? which one?
06-09-2014 12:35 PM - edited 06-09-2014 12:36 PM
I don't know where you came up with a 2D array. Here's what I came up with.
06-09-2014 01:03 PM
@razii wrote:
I have already tried that. but the loop does not take my 2D array input string. i tried to add 4loop but did not help. ....for regular expresstion are you using ; or {}; ? which one?
Don't read the file using "read from spreadsheet file". Use the plain "read from text file", giving you a plain string..
06-09-2014 02:29 PM
please ell me what I am doing wrong! I only get the first loop and i dont know how to make it continue.
06-09-2014 02:30 PM
sorry wrong file look at this one
06-09-2014 02:33 PM
Why don't you use the code suggested above?
06-09-2014 02:41 PM
06-09-2014 03:04 PM
I did but I get all the code to my output .. can not see what he is using after loop, insted I used "spreadsheet string to array" ..