Hey Guys, I was just wondering if anybody could help me with a little project I am working on. I have a txt file that I am trying to run a preg_match on to find patterns that start with with a certain phrase, and then end with a certain phrase and then have both phrases deleted as well as everything in between. So just as an example, say this following is the text in my file. Lorem ipsum dolor sit amet, consectetur adipiscing elit. <onions> Donec ac nunc turpis, ut accumsan turpis. In </oranges> vitae tellus nulla. Duis iaculis enim leo. Nulla sagittis vestibulum dictum. Quisque eget facilisis libero. Nam tempor pretium malesuada. Suspendisse eros metus, laoreet in pharetra nec, vulputate vulputate urna. Vivamus quis mi ipsum, id pretium lorem. Ut eget magna lacus, a feugiat elit. Vestibulum blandit fringilla odio, et aliquam ipsum dapibus quis. <onions> Morbi euismod erat eget purus</oranges> viverra congue. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam eleifend volutpat ipsum at consectetur. Nullam nisi est, elementum vitae luctus sit amet, pulvinar vel lectus. I want it to be able to scan the entire file finds any patterns with <onions> and </oranges> delete them and everything in between. So in this scenario it would delete the following: <onions> Donec ac nunc turpis, ut accumsan turpis. In </oranges> <onions> Morbi euismod erat eget purus</oranges> Any ideas? Any help would be appreciated.
If you want to learn preg_match then read this article which have some examples at http://html5planet.blogspot.in/2012/09/learn-php-pregmatch-with-working-example.html