![]() |
|
|
|
#1 |
|
I'm having a regular expression issue that I need some help with. I
have a string which looks something like this "25 A 24 A AA A 99 A CC" I need to take the 2 character elements and put them into an array, and each 2 character code is separated by " A " (i.e., space A space). I have been using a Split function something like this: Split(strTemp, " A ") but I came across the above string which has an "AA" 2 character code, and instead of getting "AA" as an element in the array, I got: "AA A 99" I don't understand why the space A space expression is not working! Any ideas? Thanks! godfather2 |
|
|
|
|
#2 |
|
Posts: n/a
|
I don't understand what Split(strTemp, " A ") means. To do your split, try:
split /\s+A\s+/, $strTemp; godfather2 wrote: > I'm having a regular expression issue that I need some help with. I > have a string which looks something like this > > "25 A 24 A AA A 99 A CC" > > I need to take the 2 character elements and put them into an array, > and each 2 character code is separated by " A " (i.e., space A space). > I have been using a Split function something like this: > > Split(strTemp, " A ") > > but I came across the above string which has an "AA" 2 character code, > and instead of getting "AA" as an element in the array, I got: > > "AA A 99" > > I don't understand why the space A space expression is not working! > Any ideas? > > Thanks! |
|