View previous topic :: View next topic |
Author |
Message |
me_naveen Beginner
Joined: 21 Dec 2007 Posts: 23 Topics: 12
|
Posted: Mon Jun 25, 2018 1:20 am Post subject: How exactly to inspect the mail-id in the given scenario |
|
|
Hi,
I have a field such as mail-id. Need to validate as below.
mail-id new rule as:
mail id could have comment also included(optional).But , in case if included
could be included at start or end of the local part of the mail-id(before @ symbol).
Examples as
subject(comment)@sub.com ==> VALID
(comment)subject@sub.com ==> VALID
sub(comment)ject@sub.com ==> Invalid ( '(comment)' is included in the local part other than start or end of local part of the mail-id.
In case comment such as (comment) comes other than start or end of the mail-id , it should throw an error.
How could I implement such logic.
Thanks in advance.
Nav |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Mon Jun 25, 2018 3:56 am Post subject: |
|
|
You do not mention which programming language you are using so this is a generic answer:
Code: | Split the line at the @ sign
Check that there is a '(' in the first string
If yes
If the first character is '@' or the last character is ')'
Then OK
Else give error (do not 'throw' an error as errors are not 'throw' on the mainframe)
|
_________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
me_naveen Beginner
Joined: 21 Dec 2007 Posts: 23 Topics: 12
|
Posted: Mon Jun 25, 2018 5:18 am Post subject: |
|
|
Hi,
Sorry for not including the Programming Language.
This is for COBOL.
Thanks,
Nav |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Mon Jun 25, 2018 8:16 am Post subject: |
|
|
Still. that spec will work for a routine written in COBOL. _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
|
|