I’m trying to find a sub-string matching the pattern ddddTdddd (where d is any digit and T is the letter T) in a certain string.
I’m using the PHP function preg_match() and I’m passing ‘/(\d{8})(T)(\d{8})/’ as the pattern but it’s not working for me. Here’s how I’ve written the line:
preg_match('/(\d{8})(T)(\d{8})/', $my_string, $matches);
I’m assuming the why I formatted the pattern is wrong. Can anyone please confirm whether I have the correct format or not?
Thank you!
Your regex is not correct try this