Solved

preg_replace arguments to remove mailing list footer

Posted on 2003-11-24
5
270 Views
Last Modified: 2006-11-17
Hi All;

I need the expression to do a preg_replace on this:

--
MySQL General Mailing List


I need to remove it from the bottom of emails, I want to remove everything below this line from the email I am processing. 500 points because I want to take care of this tonite.
0
Comment
Question by:Squeebee
5 Comments
 
LVL 19

Expert Comment

by:Michael701
ID: 9815569
like this?

$pos = strpos ($mystring, "MySQL General Mailing List");
if ($pos)
{
  $mystring = substr($mystring, 0, $pos)
}
0
 
LVL 17

Author Comment

by:Squeebee
ID: 9815582
While I am sure that will work, I am trying to pass an argument to an existing app, and the existing app uses preg_replace. As such I need a preg_replace expression.
0
 
LVL 6

Accepted Solution

by:
andreif earned 500 total points
ID: 9815890
$text = preg_replace('/MySQL General Mailing List/i','', $text)

I wonder if those "--" are part of the string? then try

$text = preg_replace('/\-\-[\n\r]+MySQL General Mailing List/is','', $text)
0
 
LVL 10

Expert Comment

by:NetGroove
ID: 9817106


$text = preg_replace('/MySQL General Mailing List[.\n\r]*/i','', $text);

0
 
LVL 17

Author Comment

by:Squeebee
ID: 9817710
Thanks andreif I will give that a try and get back to you.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now