I know strlen is used to determine the string length – but is it possible to search an entire block of text and pull out strings that are exactly 8 characters long?
Share
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.
The following assumes by “strings exactly eight characters long” you mean “words”, e.g. in a text like
you want to find the word “compiler” only.
Non-Regex solution (demo):
Reference:
str_word_count— Return information about words used in a stringarray_filter— Filters elements of an array using a callback functionRegex solution (demo):
Reference:
preg_match_all— Perform a global regular expression match