I have a string in following patterns.
A-B-C-D
A-AB-C-DP
AQ-B-MN-QD
and so on. The pattern follows same rule that each string has 4 group of letter(s) separated by a dash. But string might have a group with any combination of one or two letters as above.
Now what i want to do is replace the letter(s) that comes after 2nd and 3rd dash.
if the letters in group have been consistent, it would have easier for me to use strpos
and substr
functions to do that. But here the letters are not consistent in a group. How to do this in this scenario?
Thanks