Michal S
Michal S

Reputation: 1113

PHP: Selection of text between two tags with help of regular expression

I got this regular expression for selection of text between tags.

preg_match_all('/<t>(.*?)<\/t>/s', $text, $match);

what I need is to edit this expression so it would select the text only if it is at least 3 characters long... Is it possible? If yes, how?

Upvotes: 0

Views: 136

Answers (2)

Grijesh Chauhan
Grijesh Chauhan

Reputation: 58271

'/<t>(.{3,}?)<\/t>/s'

Upvotes: 3

cleong
cleong

Reputation: 7606

preg_match_all('/<t>(.{3,}?)<\/t>/s', $text, $match);

Upvotes: 2

Related Questions