Forum Discussion

chathurad's avatar
chathurad
Contributor
6 years ago

How to validate a email address from groovy scripting

import net.sf.json.groovy.*; import net.sf.json.groovy.JsonSlurper; def Res = context.expand( '${Users - Request 1#Response}' ) def slurper = new JsonSlurper() def json = slurper.parseText Res def...
  • chathurad's avatar
    6 years ago

    I did by below code.

     

    import net.sf.json.groovy.*;
    import net.sf.json.groovy.JsonSlurper;
    
    def Res = context.expand( '${Users - Request 1#Response}' )
    
    def slurper = new JsonSlurper()
    
    def json = slurper.parseText Res
    def Email = json.email
    
    int i =0;
    
    Email.each()
    {
    	assert Email[i].contains('@')
    	
    	log.info Email[i]
    	i++
    }