Jump to content

can't find a custom function-- email "From" parser


This topic is 6471 days old. Please don't post here. Open a new topic instead.

Recommended Posts

This must exist, but I haven't been successful at finding it.. Has anyone seen a custom function that will parse the "From" field in an email ?

"Full Name"

to-->

first name:

last name:

email address:

The tricky part is that Full Name can be

last, first

first last

first initial last

first mi. last

etc.

I'm writing something that takes a good guess at this, and realize nothing will be perfect because of the crap in crap out rule.. (if a person has "yoda" in for their full name, my function will fail.. but I want to take the best possible stab?

Am I reinventing the wheel and if so, can someone point me to it ?

thanks :)

Link to comment
Share on other sites

Something like this does the trick.. about 90-95 % of the time

to parse/guess the First Name out..




Let (



  [ 



   Lquot = Position(From; """; 1; 1);

   Rquot = Position(From; """; 1; 2);

   Lbrac = Position(From; "<"; 1; 1);

   Rbrac = Position(From; ">"; 1; 1);

   Name = Middle(From; Lquot+1; Rquot-(Lquot+1));

   Email = Middle(From; Lbrac+1; Rbrac-(Lbrac+1));

  comma = Position(Name; ","; 1; 1)





        ]; 



Case(

     PatternCount(Name;",") >0 ;

     Middle(Name; comma+2; (Rquot-(comma+2)));

     LeftWords(Name; 1)

        )

)

My situation is one where the data entry person will have to check the name anyway, so parsing this and dumping it onto a layout will be a bit timesaver.

Are there any problems with this code?

Link to comment
Share on other sites

This topic is 6471 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.