ted_chou12 Posted November 17, 2008 Share Posted November 17, 2008 How do you use preg_match to match <p>texts<tags>....</p> with tags inside? Thanks, Link to comment https://forums.phpfreaks.com/topic/133024-solved-preg-match/ Share on other sites More sharing options...
genericnumber1 Posted November 17, 2008 Share Posted November 17, 2008 What's wrong with something simple like <p>(.+?)</p> ? Or, for a more general purpose solution, <([a-zA-Z]+).*?>(.+?)</\1> ? I guess I'm not quite understanding the question. Link to comment https://forums.phpfreaks.com/topic/133024-solved-preg-match/#findComment-691873 Share on other sites More sharing options...
ddrudik Posted November 17, 2008 Share Posted November 17, 2008 ted_chou12, if you want to match nested/non-nested <p>...</p> blocks: preg_match_all('~<p>(??>(??!</?p>).)+)|(?0))*</p>~is',$yourstring,$matchesarray); Link to comment https://forums.phpfreaks.com/topic/133024-solved-preg-match/#findComment-691986 Share on other sites More sharing options...
ted_chou12 Posted November 17, 2008 Author Share Posted November 17, 2008 Thanks, I will try them! Link to comment https://forums.phpfreaks.com/topic/133024-solved-preg-match/#findComment-692050 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.