Regular Expression problem

G

godfather2

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!
 
S

Shawn Corey

I don't understand what Split(strTemp, " A ") means. To do your split, try:

split /\s+A\s+/, $strTemp;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top