Solved

preg_replace arguments to remove mailing list footer

Posted on 2003-11-24
5
277 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

630 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