Hi i'm working on my grails application in wich i connect to gmail via imap and wait for incoming emails. When an email arrives i need to fetch its content and it suppose to be a string. Then i need to match this string to a regexp to get the most valuable data. The problem is that there is something wrong with this string and it doesn't match my regexp which i tested on usual multiline groovy string and everything worked fine.

```
def processMessage(def imapMessage){
  if(message && message instanceof IMAPMessage){
              def content = message.getContent()
              println 'Content ='+ content
              m_mailContent = content
              println 'm_mailContent is ' + m_mailContent
          } 

```

And then

```
def getType(){
       def type = 0 
       if(utility.ParseUtil.matches(m_mailContent, WEB_SERVICE_REGEXP)){
          type = 1
       }else if(utility.ParseUtil.matches(m_mailContent, BNET_REGEXP)){
           type = 2
       }else if(utility.ParseUtil.matches(m_mailContent, QUEUED_REGEXP)){
           type = 3
       }
        return type
    }
But i almost always get type = 0

```

I might need to do something to that string. I have no idea what kind of string i get. When print it everything seems fine. Of course it could be some special characters in it but do i escape them? 

```
def WEB_SERVICE_REGEXP = /.*ErrorID:\s*[A-Za-z\d\/\.-]*\n.*Time:\s*[A-Za-z\d\/\s:]*\n.*URL:\s*[A-Za-z\d\/\.]*\n/

```

and a string i get from gmail is something like this

```
ErrorID:  -732861900
Time:     Tue May 24 09:57:54 CEST 2011
URL:      /transnet/organisation.jsp
HttpCode: 500
Error:    class java.lang.SecurityException: Access denied.
User:     Peter Rådlund (peraa), DHL Express (Sweden) AB
Domain:   DHL Support

Stacktrace
----------------------------------------------------------------------
java.lang.SecurityException: Access denied.
       at com.memnon.transnet.admin.Account.checkUpdate(Account.java:725)
       at com.memnon.transnet.consignment.ConsignmentDB.updateOrganisation(ConsignmentDB.java:152)
       at org.apache.jsp.transnet.organisation_jsp._jspService(organisation_jsp.java:842)
       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.A

```

i try to mach it like this

```
//ParseUtil
static def matches(String str, def regexp){
            def m  = str =~ regexp
            m.find()
        }

```

I hope it's kind of clear now.