I have several thousand text strings where the IMDB occures in fairly random positions, but its always in the following format: tt0234215 (tt + some numbers).
What would be the best way to strip it out in php?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Probably by using a regular expression:
This will search the string for all instances of "tt" followed by exactly seven digits and return them as an array (extra digits will be ignored). (
preg_match_allin the PHP docs)