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

  • Home
  • SEARCH
  • 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 8273291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:25:25+00:00 2026-06-08T07:25:25+00:00

How can I successfully parse the text below in that format to parse just

  • 0

How can I successfully parse the text below in that format to parse just

To: User <test@test.com> 

and

To: <test@test.com>

When I try to parse the text below with

/To:.*<[A-Z0-9._+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}>/mi

It grabs

Message-ID <CC2E81A5.6B9%test@test.com>, 

which I dont want in my answer.

I have tried using $ and \z and neither work. What am I doing wrong?

Information to parse

To: User <test@test.com> Message-ID <CC2E81A5.6B9%test@test.com>
To:

<test@test.com>

This is my parsing information in Rubular http://rubular.com/r/DQMQC4TQLV

  • 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-06-08T07:25:29+00:00Added an answer on June 8, 2026 at 7:25 am

    Since you haven’t specified exactly what your tool/language is, assumptions must be made.

    In general regex pattern matching tends to be aggressive, matching the longest possible pattern. Your pattern starts off with .*, which means that you’re going to match the longest possible string that ENDS WITH the remainder of your pattern <[A-Z0-9._+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}>, which was matched with <CC2E81A5.6B9%test@test.com> from the Message-ID.

    Both Apalala’s and nhahtdh’s comments give you something to try. Avoid the all-inclusive .* at the start and use something that’s a bit more specific: match leading spaces, or match anything EXCEPT the first part of what you’re really interested in.

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

Sidebar

Related Questions

i have an iphone 3g and can successfully send text messages using the PHP
I can successfully parse the contents of a JSON file, using the JSON-Framework 3.0,
I have an asp.net WebMethod that returns an XmlDocument object. I can successfully call
I parse a text file with the script below. How to insert the array
I use jQuery to parse an RSS feed. I can successfully get the RSS
I have a RichTextBox that the user can edit to create a hyperlink (in
I can successfully receive email from SendGrid and process its data. My problem is
I can successfully get the title, version and icon of an app using the
I can successfully do this: App.SomeCollection = Backbone.Collection.extend({ comparator: function( collection ){ return( collection.get(
Can anyone explain how I can successfully get my processes communicating? I find the

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.