gnu-regexp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Regexp] gnu-regexp-1.1.4 question -- expert needed


From: jon
Subject: RE: [Regexp] gnu-regexp-1.1.4 question -- expert needed
Date: Mon, 3 Feb 2003 20:24:35 -0800

The email address provided won't accept mail.

This isn't a problem with the regexp per se. Java wants to do something with
escape sequences in strings, so add an additional backslash to all
occurrences in your regexp. It works for me ;)

Later

> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden Behalf Of
> address@hidden
> Sent: Monday, February 03, 2003 5:12 PM
> To: address@hidden
> Subject: [Regexp] gnu-regexp-1.1.4 question -- expert needed
>
>
> Hi All,
> I am developing an open source tool called JCSC
> (http://jcsc.sourceforge.net) and I want to add an additional
> check on java source files. This check should check if the .java
> file has the correct header. In the case of JCSC each class has a
> FSF header. The regexp has been tested and seems to be ok but the
> code does not work.
> I tried everything I could think about -- no success. Can an regexp expert
> please have a look into that and tell me why this match does not
> match - Thanks!
>
> Here the java code:
>
>    static public void handleTypeHeader(StringBuffer pHeader, int
> pLine, int pColumn)
>    {
>       String header = pHeader.toString();
>
>       header = header.trim();
>       sTypeHeaderRegexp = sTypeHeaderRegexp.trim();
>
>       System.out.println("'" + header + "'");
>       System.out.println("-----------------------------------");
>       System.out.println("'" + sTypeHeaderRegexp + "'");
>
>       if (sReguiresHeader)
>       {
>          if (! isRegexpMatch(sTypeHeaderRegexp, header))
>          {
>             addViolation(0, 0, "type does not have the correct header");
>          }
>       }
>    }
>
>     static boolean isRegexpMatch(Object regexp, Object value)
>     {
>         try
>         {
>             RE reg = new RE(regexp.toString());
>
>             if (reg.isMatch(value.toString()))
>             {
>                 return true;
>             }
>         }
>         catch (REException e)
>         {
>             e.printStackTrace();
>         }
>
>         return false;
>     }
>
>
> and here the output - You can see the text and the regexp.
>
> '/*
>  * Copyright (C) 1999-2002 Ralph Jocham
>  * This program is free software; you can redistribute it and/or
>  * modify it under the terms of the GNU General Public License
>  * as published by the Free Software Foundation; either version 2
>  * of the License, or (at your option) any later version.
>  *
>  * This program is distributed in the hope that it will be useful,
>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  * GNU General Public License for more details.
>  *
>  * You should have received a copy of the GNU General Public License
>  * along with this program; if not, write to the Free Software
>  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
> 02111-1307, USA.
>  */'
> -----------------------------------
> '/\*
>  \* Copyright \(C\) 1999-2002 Ralph Jocham
>  \* This program is free software; you can redistribute it and/or
>  \* modify it under the terms of the GNU General Public License
>  \* as published by the Free Software Foundation; either version 2
>  \* of the License, or \(at your option\) any later version\.
>  \*
>  \* This program is distributed in the hope that it will be useful,
>  \* but WITHOUT ANY WARRANTY; without even the implied warranty of
>  \* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\.  See the
>  \* GNU General Public License for more details\.
>  \*
>  \* You should have received a copy of the GNU General Public License
>  \* along with this program; if not, write to the Free Software
>  \* Foundation, Inc\., 59 Temple Place - Suite 330, Boston, MA
> 02111-1307, USA\.
>  \*/'
>
> __________________________________________________________________
> The NEW Netscape 7.0 browser is now available. Upgrade now!
> http://channels.netscape.com/ns/browsers/download.jsp
>
> Get your own FREE, personal Netscape Mail account today at
http://webmail.netscape.com/


_______________________________________________
Gnu-regexp-users mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/gnu-regexp-users






reply via email to

[Prev in Thread] Current Thread [Next in Thread]