Reputation: 27862
The following command will find me those strings which have more than 255 characters that are not white space.
egrep -norq '[^ ]{255,}'
If I have a string in $content
, how would I find (in PHP) all the occurrences of strings that are longer than 255 characters, and save those occurrences so that later I can echo them?
Upvotes: 1
Views: 659
Reputation: 786041
In PHP you use preg_match
for matching:
// assuming $content is your input
if ( preg_match_all('/\S{255,}/', $content , $m ) ) {
// save $content
}
\S
=> matches any non space character{255,}
=> makes sure there are at least 255 characters in inputUpvotes: 2