Preg_Split / Regular Expressions
Posted: Thu Jun 22, 2006 2:53 pm
I need help with two string-splitting cases.
1) The first set of strings take the following form:
ABC111111, ZZZ2222222, XXXXX34536474
In this case, I would like the split to occur after the last occurence of an alphabetic letter. For instance, using the first two examples above:
Array[0] = ABC
Array [1] = 111111
Array[0] = XXXXX
Array [1] = 34536474
What regular expression would I use with preg_split in this case?
2) In the second case, there are some letters before and after a common number sequence. For instance:
EB1234666666, CBB123477777777
In this case, I would like to split the string after the '1234' sequence. For instance, using the first two examples above:
Array[0] = EB1234
Array [1] = 666666
Array[0] = CBB1234
Array [1] = 77777777
What regular expression would I use with preg_split in this case?
Any help would be appreciated.
1) The first set of strings take the following form:
ABC111111, ZZZ2222222, XXXXX34536474
In this case, I would like the split to occur after the last occurence of an alphabetic letter. For instance, using the first two examples above:
Array[0] = ABC
Array [1] = 111111
Array[0] = XXXXX
Array [1] = 34536474
What regular expression would I use with preg_split in this case?
2) In the second case, there are some letters before and after a common number sequence. For instance:
EB1234666666, CBB123477777777
In this case, I would like to split the string after the '1234' sequence. For instance, using the first two examples above:
Array[0] = EB1234
Array [1] = 666666
Array[0] = CBB1234
Array [1] = 77777777
What regular expression would I use with preg_split in this case?
Any help would be appreciated.