2009 Aug 04 3:24 PM
Dear All,
how can I detect the next 2 characters after @ at a email address.
regards
marco m
2009 Aug 04 3:31 PM
HI,
Check the following code.
split v_email at '@' int0 var1 var2.
var3 = var2+0(2).
.
Suppose v_email contains an email address. Then var1 will contain the first part (brfore @) and var2 will hold the second part (after @).
Var3 will have first two characters.
Hope this helps.
Regards,
Sachin
2009 Aug 04 3:26 PM
Hi,
use SPLIT statement to split the address into 2 variable or an internal table splitting at '@'.
And then use offset to find the 2 characters.
Regards,
Ankur Parab
Edited by: Ankur Parab on Aug 4, 2009 7:57 PM
2009 Aug 04 3:28 PM
2009 Aug 04 3:30 PM
Hi,
You can also use CP to find the postion of '@" in an email address.
The position will be in SY-FDPOS field if the CP is successful and then make use of offset to find the next 2 characters.
Regards,
Ankur Parab
2009 Aug 04 3:31 PM
yes, you can search for @ and use the position to get the next two chars or you can use regular expressions.
2009 Aug 04 3:31 PM
Hi,
You could use the SEARCH command, which will put the position of the @ into field sy-fdpos. Then you can use this value as the offset to get the next two characters.
But I prefer the suggestion to use SPLIT.
Regards,
Nick
2009 Aug 04 3:31 PM
HI,
Check the following code.
split v_email at '@' int0 var1 var2.
var3 = var2+0(2).
.
Suppose v_email contains an email address. Then var1 will contain the first part (brfore @) and var2 will hold the second part (after @).
Var3 will have first two characters.
Hope this helps.
Regards,
Sachin
2009 Aug 04 3:44 PM
REPORT ZREGEX.
data:
s type string,
substr type string.
START-OF-SELECTION.
// this is needed because its not allowed to post email addresses.
concatenate `someone` `@` `example.org`into s.
find FIRST OCCURRENCE OF regex '@(..)' in s submatches substr.
write:/ s.
write:/ substr.