Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7063059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:40:07+00:00 2026-05-28T04:40:07+00:00

How would I ignore everything after a certain section in a string? The challenge

  • 0

How would I ignore everything after a certain section in a string?

The challenge is that the string is variable and won’t be the same every time.

Here’s an example of what I want to do:


This is the part of the string I want to read

I DO NOT WANT TO READ ANYTHING FROM THIS POINT ON…

(IGNORE ALL OF THIS) On Sun, Jan 15, 2012 at 11:55 AM, wrote:

Then I want to return JUST the part I want to read so I can check it and do what I need with that data…The problem is that the “On Sun, Jan 15, 2012 at 11:55 AM, wrote:” is always going to be different and variable…so I think I would have to use a preg_match to find this phrase? Not sure on this…thanks for your help!

Just thought of something else I could do to make this work…

What I’m doing is checking the body of an email for certain words or phrases and then performing a specific task if a phrase is found…I already have that part written. What could POSSIBLY work is if a particular phrase is found in the string, I would need it to STOP checking the rest of the string. Crap…actually this will ONLY work if the phrase IS found in the first part…if it’s NOT found in the first part, then the script would continue checking the string and it might find the phrase I am looking for in the second part which would cause my functionality to not perform correctly. Just a thought….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:40:08+00:00Added an answer on May 28, 2026 at 4:40 am
    $string = "This SHOULD be displayed    On Tue, Jan 17, 2012 at 6:05 PM   I wrote: And this should NOT be displayed";
    $output = array();
    
    preg_match("/On (\w{3}), (\w{3}) (\d{2}), (\d{4}) at (\d{1,2}:\d{2}) (\w{2})/", $string, $output);
    $string = explode($output[0], $string);
    $string = trim($string[0]);
    

    This will cut the string at On Tue, Jan 17, 2012 at 6:05 PM and return the text preceding the date.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i've got a String like DE32424;WV424324;FR234324;DE45345 How would I ignore everything after the
I am interested in writing a trigger that would ignore queries from a specific
I would like TortoiseSVN (1.5.3) to ignore certain folders, their contents and certain other
Any thoughts on why this isn't working? I really thought 'ignore' would do the
I'm using the built-in SpellCheck for the WPF RichTextBox and would like to ignore
I've ignored this topic for really long time and I would like to get
I've found Ruby to be very attractive; I like the fact that everything is
In Codeigniter is it possible to make routing ignore a certain pattern but route
I'm trying to extract lines from certain files that do not begin with #
I have a written C++ server app that I would like to be able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.