Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hi all friends

I tried to make a CF (recursive) to grab all the eMails from a given text ... but for now I do not got !

I thinked to count the words and so on...

but the "@" character is considered a delimiter of words (as comment kindly explained to me).

So I stopped !

The same CF can grab all the words with a given string inside them.

Kind of: GetWords(text;string)

PS: I can't find a similar CF in the brilliant Brian site

Posted

I don't see what difference it makes if "@" is a word delimiter or not. The question is how are your addresses separated from each other and from the rest of the text.

FWIW, Ray has a scripted e-mail extractor on his site, which you could adapt to a CF, but I have to warn you that it fails at perfectly valid addresses.

Posted

Hi,

I solved my problem with this recursive custom function that grab all the emails from a given generic text:

GetEmail ( text ) custom function


/*

Author

Daniele Raybaudi

*/

Let([

count = PatternCount ( text ; "@" );

len = Length ( Text );

pos = Position ( Text ; "@" ; 1 ; 1 );

ante@ =  RightWords ( Middle (Text ;1 ;pos  ) ; 1 );

post@ =  LeftWords ( Middle (Text ; pos ; len ) ; 1 );

nextText = Middle ( text ; pos + 1 ; len )

];

Case(

count ; ante@ & "@" & post@ & "¶" & GetEmail ( nextText );

""

)

)

Posted

Hi comment

there is a great difference!

If "@" is a delimiter of words, I can easily get the left side and the right side of it with RightWords and LeftWords , as I did !

Posted

I'd suggest you check out some references on what is a valid e-mail address, then see if your CF extracts all possible variations.

See for example:

http://www.ietf.org/rfc/rfc0822.txt

http://www.developer.com/lang/php/article.php/3290141

http://www.webreference.com/js/tips/000310.html

Posted

ok

so my CF is, for now, good only for the most usually emails, NOT FOR ALL !

Thanks to comment.

BTW I'm reading that looongs links... and I'll search to implement all the possibilities !

Posted

Hi

this works for all the emails !

/*

Author

Daniele Raybaudi

*/

Let([

adjustedText = Substitute ( text ; "¶" ; " " );

count = PatternCount ( adjustedText ; "@" );

len = Length ( adjustedText );

pos = Position ( adjustedText ; "@" ; 1 ; 1 );

startWord = Position ( adjustedText ; " " ; pos ; -1 ) + 1;

endWord = If ( Position ( adjustedText ; " " ; pos ; 1 ) ≠ 0 ; Position ( adjustedText ; " " ; pos ; 1 ) ; len + 1  );

word = Middle ( adjustedText ; startWord ; endWord - startWord );

nextText = Middle (adjustedText ; endWord + 1 ; len )

];

Case(

count ; word & "¶" & GetEmail ( nextText );

""

)

)

Posted

And this works for all the words that contains a given string.

GetWords(text;string)


/*

Author

Daniele Raybaudi



modified 09/13/2005

*/

Consenti([

adjustedText = CercaeSost ( text ;  

["¶";" "];

[",";" "];

[".";" "];

[":";" "];

[";";" "];

["!";" "];

["?";" "];

[""";" "];

["(";" "];

[")";" "];

["%";" "];

["/";" "];

["*";" "];

["-";" "];

["[";" "];

["]";" "];

["'";" "];

["£";" "];

["$";" "];

["&";" "];

["=";" "];

["^";" "];

["+";" "];

["§";" "];

["°";" "];

["#";" "];

["_";" "];

["<";" "];

[">";" "];

["";" "]);

count = ContaRicorrenze ( adjustedText ; string );

len = Lunghezza ( adjustedText );

pos = Posizione ( adjustedText ; string ; 1 ; 1 );

startWord = Posizione ( adjustedText ; " " ; pos ; -1 ) + 1;

endWord = If ( Posizione ( adjustedText ; " " ; pos ; 1 ) ≠ 0 ; Posizione ( adjustedText ; " " ; pos ; 1 ) ; len + 1  );

word = Mezzo ( adjustedText ; startWord ; endWord - startWord );

nextText = Mezzo (adjustedText ; endWord + 1 ; len )

];

Casi(

count ; word & "¶" & GetWords ( nextText;string );

""

)

)

This topic is 7013 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.