Automatically Strip fields/data out of text?

30 views
Skip to first unread message

Tikka308

unread,
Mar 12, 2012, 6:14:57 PM3/12/12
to NYCResistor:Microcontrollers
Is there a way (or a program) where I could copy text from an email
(see example below) and, every time, strip out certain fields? e.g.
take the text below and strip out the fields for First, Last, &
Address?

Thanks.

Customer ID : 89
First Name : John
Last Name : Doe
Company :
Address : 123 Main Street
City : New York
State/Province : NY
Zip/Postal Code : 10001
Country :
Phone : 123456789
Fax :
E-Mail : joh...@gmail.com

Sam Tarakajian

unread,
Mar 12, 2012, 6:30:53 PM3/12/12
to nycresistormi...@googlegroups.com
https://github.com/petewarden/dstk

Maybe?


--
You received this message because you are subscribed to the Google Groups "NYCResistor:Microcontrollers" group.
To post to this group, send email to nycresistormi...@googlegroups.com.
To unsubscribe from this group, send email to nycresistormicrocon...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nycresistormicrocontrollers?hl=en.


Darcy Whyte

unread,
Mar 12, 2012, 6:33:31 PM3/12/12
to nycresistormi...@googlegroups.com
should be easy, what language or environment are you working with?

Dan Lavin

unread,
Mar 12, 2012, 6:42:16 PM3/12/12
to nycresistormi...@googlegroups.com
awk was made for this sort of thing.
> http://www.gnu.org/software/gawk/manual/gawk.html

AtomSoft

unread,
Mar 12, 2012, 9:01:43 PM3/12/12
to nycresistormi...@googlegroups.com
If you are using C# Express (free) you can simply read a line and then split it by the Colon ":" and the data will be placed in a array where like:

//-------------------------------------------------------------------------------------
//Get Line into a string... as a test using prepared string
    string value = "E-Mail : E-Mail : joh...@gmail.com";

// Use a new char[] array of ( : ) to break
// lines from into separate strings. Use "RemoveEmptyEntries"
// to make sure no empty strings get put in the string[] array.
//
    char[] delimiters = new char[] { ':' };
    string[] parts = value.Split(delimiters,StringSplitOptions.RemoveEmptyEntries);
   
    for (int i = 0; i < parts.Length; i++)
    {
    Console.WriteLine(parts[i]);
    }

// parts[0] should contain E-Mail :
// parts[1] should contain joh...@gmail.com
//-------------------------------------------------------------------------------------

Ronald "Monty" Montemayor

unread,
Mar 12, 2012, 10:22:53 PM3/12/12
to nycresistormi...@googlegroups.com
Using "Regular Expression", and PERL...  

You won't believe it,   Probably just 1 line of a few strings of regular expression is what it all takes.



Ronald "Monty" Montemayor

unread,
Mar 12, 2012, 10:31:59 PM3/12/12
to nycresistormi...@googlegroups.com
Using "Regular Expression", and PERL...  

You won't believe it,   Probably just 1 line of a few strings of regular expression is what it all takes.

But what exactly you are trying to do?

Tikka308

unread,
Mar 16, 2012, 9:21:08 AM3/16/12
to NYCResistor:Microcontrollers
FYI I figured out how to do this in Excel (easiest for me since I'm
not a programmer).

If cell B3 has the text "First Name : Justin"
then you can use the formula "=MID(B3,(FIND(":",B3)+1),90)" to extract
"Justin".
> E-Mail : john...@gmail.com

AtomSoft

unread,
Mar 16, 2012, 11:06:38 AM3/16/12
to nycresistormi...@googlegroups.com
Glad you figured out a way, but this was way too broad of a question. Try being a little more specific next time and i bet more help would have come. Also thanks! for the Excel tip.
Reply all
Reply to author
Forward
0 new messages