From regexp-user-jennifer75@example.com Wed May 09 01:59:06 2001
Return-Path: <regexp-user-jennifer75@example.com>
Delivered-To: jennifer75@example.com
Received: (qmail 53480 invoked by uid 500); 9 May 2001 01:59:03 -0000
Mailing-List: contact jennifer75@example.com; run by ezmlm
Precedence: bulk
Reply-To: jennifer75@example.com
list-help: <mailto:jennifer75@example.com>
list-unsubscribe: <mailto:jennifer75@example.com>
list-post: <mailto:jennifer75@example.com>
Delivered-To: mailing list jennifer75@example.com
Received: (qmail 53320 invoked from network); 9 May 2001 01:59:01 -0000
Message-ID: <jennifer75@example.com>
Date: Tue, 8 May 2001 21:59:23 -0400 (EDT)
From: rob <jennifer75@example.com>
To: jennifer75@example.com
Subject: help with reqular expresion
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
X-mailer: big pimpin [mail.40oz.net]
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N

im trying to come up with a working
version of a reg expression that will match all links
that are in the text of an email message.


ftp://.*
http://.*
mailto:.*

etc,

except

=http://images.blah.blah.net or
="http://images.blah.blah.net" or
='http://images.blah.blah.net'

this is what im coming up with

simpliest version
[^=][http|ftp]*?://.*?[^ ]{0,}


im using the gui demo program for my testing.

this seems somewhat right, right?, excluding mailto: tags



maybe i am doing something wrong but that expression
isnt working as i think it should.

i also noticed that [:space:] is not working correctly
that is why i used [^ ] and also the negating at the
beginning isnt working either??

any point in the right direction will be appreciated.

From regexp-user-jennifer75@example.com Wed May 09 07:42:11 2001
Return-Path: <regexp-user-jennifer75@example.com>
Delivered-To: jennifer75@example.com
Received: (qmail 73851 invoked by uid 500); 9 May 2001 07:41:59 -0000
Mailing-List: contact jennifer75@example.com; run by ezmlm
Precedence: bulk
Reply-To: jennifer75@example.com
list-help: <mailto:jennifer75@example.com>
list-unsubscribe: <mailto:jennifer75@example.com>
list-post: <mailto:jennifer75@example.com>
Delivered-To: mailing list jennifer75@example.com
Delivered-To: moderator for jennifer75@example.com
Received: (qmail 17754 invoked from network); 9 May 2001 03:17:07 -0000
From: "Michael McCallum" <jennifer75@example.com>
To: jennifer75@example.com
Date: Wed, 9 May 2001 15:16:45 +1200
MIME-Version: 1.0
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Subject: Re: help with reqular expresion
Reply-to: jennifer75@example.com
Message-ID: <3AF95F5D.14620.99AC1B3F@localhost>
Priority: normal
In-reply-to: <jennifer75@example.com>
X-mailer: Pegasus Mail for Win32 (v3.12c)
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N



On 8 May 2001, at 21:59, rob wrote:

> im trying to come up with a working
> version of a reg expression that will match all links
> that are in the text of an email message.
> 
> 
> ftp://.*
> http://.*
> mailto:.*
> 
> etc,
> 
> except
> 
> =http://images.blah.blah.net or
> ="http://images.blah.blah.net" or
> ='http://images.blah.blah.net'
> 
> this is what im coming up with
> 
> simpliest version
> [^=][http|ftp]*?://.*?[^ ]{0,}
> 
> 
> im using the gui demo program for my testing.
> 
> this seems somewhat right, right?, excluding mailto: tags
> 
> 
> 
> maybe i am doing something wrong but that expression
> isnt working as i think it should.
> 
> i also noticed that [:space:] is not working correctly
> that is why i used [^ ] and also the negating at the
> beginning isnt working either??
> 
> any point in the right direction will be appreciated.
for a start use

[^=](http|ftp)://

If you check the RETest.txt file in the docs directory there are several example near the end of 
the file to do with matching urls.



From regexp-user-jennifer75@example.com Wed May 09 07:42:17 2001
Return-Path: <regexp-user-jennifer75@example.com>
Delivered-To: jennifer75@example.com
Received: (qmail 73914 invoked by uid 500); 9 May 2001 07:42:10 -0000
Mailing-List: contact jennifer75@example.com; run by ezmlm
Precedence: bulk
Reply-To: jennifer75@example.com
list-help: <mailto:jennifer75@example.com>
list-unsubscribe: <mailto:jennifer75@example.com>
list-post: <mailto:jennifer75@example.com>
Delivered-To: mailing list jennifer75@example.com
Delivered-To: moderator for jennifer75@example.com
Received: (qmail 19324 invoked from network); 9 May 2001 03:20:13 -0000
From: "Michael McCallum" <jennifer75@example.com>
To: jennifer75@example.com
Date: Wed, 9 May 2001 15:19:51 +1200
MIME-Version: 1.0
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Subject: Re: help with reqular expresion
Reply-to: jennifer75@example.com
Message-ID: <3AF96017.2232.99AEF3A3@localhost>
Priority: normal
In-reply-to: <jennifer75@example.com>
X-mailer: Pegasus Mail for Win32 (v3.12c)
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N

Just thought that you are probably  using 1.2 so here they are...

Unfortunately you wont be able to use the reluctant closures ie ?:

#155
(([hH][tT]{2}[pP]|[fF][tT][pP]):\/\/)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*
http://www.test.com
YES
http://www.test.com
http://
http
.com

#156
((?:[hH][tT]{2}[pP]|[fF][tT][pP]):\/\/)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*
ftp://www.test.com
YES
ftp://www.test.com
ftp://
.com

#157
(([hH][tT]{2}[pP]|[fF][tT][pP]):\/\/)?[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*
htTp://www.test.com
YES
htTp://www.test.com
htTp://
htTp

#158
(?:([hH][tT]{2}[pP]|[fF][tT][pP]):\/\/)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*
FTP://www.test.com
YES
FTP://www.test.com
FTP
.com

#159
^(?:([hH][tT]{2}[pP]|[fF][tT][pP]):\/\/)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*$
http://.www.test.com
NO

#160
^(?:(?:[hH][tT]{2}[pP]|[fF][tT][pP]):\/\/)?[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*$
FtP://www.test.com
YES
FtP://www.test.com

#161
^(?:(?:[hH][tT]{2}[pP]|[fF][tT][pP]):\/\/)?[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*$
FtTP://www.test.com
NO

#162
^(?:(?:[hH][tT]{2}[pP]|[fF][tT][pP]):\/\/)?[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*$
www.test.com
YES
www.test.com

From regexp-user-jennifer75@example.com Wed May 09 13:29:16 2001
Return-Path: <regexp-user-jennifer75@example.com>
Delivered-To: jennifer75@example.com
Received: (qmail 19439 invoked by uid 500); 9 May 2001 13:28:46 -0000
Mailing-List: contact jennifer75@example.com; run by ezmlm
Precedence: bulk
Reply-To: jennifer75@example.com
list-help: <mailto:jennifer75@example.com>
list-unsubscribe: <mailto:jennifer75@example.com>
list-post: <mailto:jennifer75@example.com>
Delivered-To: mailing list jennifer75@example.com
Received: (qmail 19354 invoked from network); 9 May 2001 13:28:28 -0000
Message-ID: <jennifer75@example.com>
Date: Wed, 9 May 2001 09:28:48 -0400 (EDT)
From: rob <jennifer75@example.com>
To: jennifer75@example.com
Subject: Re: help with reqular expresion
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
X-mailer: big pimpin [mail.40oz.net]
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N

Michael,

thanks for the help, yet not even the simpliest reg
is working... i am using 1.2

import org.apache.regexp.*;

public class RegularExpression extends Object {
  public static void main(String[] args) {
    try {      
      String in = "http://link.com";      
      RE linkTransformer = new RE("[^i](http|ftp)://", RE.MATCH_CASEINDEPENDENT);
      System.out.println(linkTransformer.match(in));
      System.out.println("0: " + linkTransformer.getParen(0));
      System.out.println("0: " + linkTransformer.getParen(1));
      System.out.println("0: " + linkTransformer.getParen(2));      
    } catch (RESyntaxException x) {
      x.printStackTrace();
    }
  }
}

From regexp-user-jennifer75@example.com Wed May 09 20:51:00 2001
Return-Path: <regexp-user-jennifer75@example.com>
Delivered-To: jennifer75@example.com
Received: (qmail 20381 invoked by uid 500); 9 May 2001 20:50:45 -0000
Mailing-List: contact jennifer75@example.com; run by ezmlm
Precedence: bulk
Reply-To: jennifer75@example.com
list-help: <mailto:jennifer75@example.com>
list-unsubscribe: <mailto:jennifer75@example.com>
list-post: <mailto:jennifer75@example.com>
Delivered-To: mailing list jennifer75@example.com
Delivered-To: moderator for jennifer75@example.com
Received: (qmail 4186 invoked from network); 9 May 2001 19:38:36 -0000
X-Originating-IP: [83.161.120.155]
From: "Daniel Parker" <jennifer75@example.com>
To: <jennifer75@example.com>
References: <jennifer75@example.com>
Subject: Problem with regexp
Date: Wed, 9 May 2001 15:39:31 -0400
MIME-Version: 1.0
Content-Type: text/plain;	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
Message-ID: <jennifer75@example.com>
X-OriginalArrivalTime: 09 May 2001 19:38:05.0203 (UTC) FILETIME=[9127C630:01C0D8BF]
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N

I have the following pattern (for zip codes) which I think is OK.

^\d{5}[ -]?(\d{4})?$

The ibm regex and the apache oro regular expression tools match 5 and 9
digit strings and fail others.  The apache regexp RE object, however,
matches the 6 digit string

123456

I have quite a few test cases and this is the only place where I noted a
difference between the three tools.

Comments?

Regards,
Daniel Parker

From regexp-user-jennifer75@example.com Wed May 09 20:51:05 2001
Return-Path: <regexp-user-jennifer75@example.com>
Delivered-To: jennifer75@example.com
Received: (qmail 20732 invoked by uid 500); 9 May 2001 20:50:58 -0000
Mailing-List: contact jennifer75@example.com; run by ezmlm
Precedence: bulk
Reply-To: jennifer75@example.com
list-help: <mailto:jennifer75@example.com>
list-unsubscribe: <mailto:jennifer75@example.com>
list-post: <mailto:jennifer75@example.com>
Delivered-To: mailing list jennifer75@example.com
Delivered-To: moderator for jennifer75@example.com
Received: (qmail 25082 invoked from network); 9 May 2001 19:50:15 -0000
From: "Michael McCallum" <jennifer75@example.com>
To: jennifer75@example.com
Date: Thu, 10 May 2001 07:49:50 +1200
MIME-Version: 1.0
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Subject: Re: help with reqular expresion
Reply-to: jennifer75@example.com
Message-ID: <3AFA481E.21203.9D3952F0@localhost>
Priority: normal
In-reply-to: <jennifer75@example.com>
X-mailer: Pegasus Mail for Win32 (v3.12c)
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N

Hi Rob,

Start it real simple and add bits.

so first match http 
then http|ftp
....
until you have the whole thing working.

That way you can identify which bits dont work as you expect.

I know 1.2 works for matching url because I have done it at work and with the test cases.
Its harder without non matching closures to get back the match though :(

Michael


From regexp-user-jennifer75@example.com Thu May 10 05:06:42 2001
Return-Path: <regexp-user-jennifer75@example.com>
Delivered-To: jennifer75@example.com
Received: (qmail 75347 invoked by uid 500); 10 May 2001 05:06:38 -0000
Mailing-List: contact jennifer75@example.com; run by ezmlm
Precedence: bulk
Reply-To: jennifer75@example.com
list-help: <mailto:jennifer75@example.com>
list-unsubscribe: <mailto:jennifer75@example.com>
list-post: <mailto:jennifer75@example.com>
Delivered-To: mailing list jennifer75@example.com
Delivered-To: moderator for jennifer75@example.com
Received: (qmail 66748 invoked from network); 10 May 2001 04:47:34 -0000
From: "Michael McCallum" <jennifer75@example.com>
To: jennifer75@example.com
Date: Thu, 10 May 2001 16:47:12 +1200
MIME-Version: 1.0
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Subject: Re: Problem with regexp
Reply-to: jennifer75@example.com
Message-ID: <3AFAC610.15816.9F255130@localhost>
Priority: normal
In-reply-to: <jennifer75@example.com>
X-mailer: Pegasus Mail for Win32 (v3.12c)
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N

Probably an off by one somewhere in there will have a look when I have time.

On 9 May 2001, at 15:39, Daniel Parker wrote:

> I have the following pattern (for zip codes) which I think is OK.
> 
> ^\d{5}[ -]?(\d{4})?$
> 
> The ibm regex and the apache oro regular expression tools match 5 and 9
> digit strings and fail others.  The apache regexp RE object, however,
> matches the 6 digit string
> 
> 123456
> 
> I have quite a few test cases and this is the only place where I noted a
> difference between the three tools.
> 
> Comments?
> 
> Regards,
> Daniel Parker



From regexp-user-jennifer75@example.com Thu May 10 20:52:06 2001
Return-Path: <regexp-user-jennifer75@example.com>
Delivered-To: jennifer75@example.com
Received: (qmail 38714 invoked by uid 500); 10 May 2001 20:51:48 -0000
Mailing-List: contact jennifer75@example.com; run by ezmlm
Precedence: bulk
Reply-To: jennifer75@example.com
list-help: <mailto:jennifer75@example.com>
list-unsubscribe: <mailto:jennifer75@example.com>
list-post: <mailto:jennifer75@example.com>
Delivered-To: mailing list jennifer75@example.com
Received: (qmail 38662 invoked from network); 10 May 2001 20:51:40 -0000
Sender: kris
Message-ID: <jennifer75@example.com>
Date: Thu, 10 May 2001 14:48:34 -0500
From: Kris Gonzalez <jennifer75@example.com>
X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.14-5.0 i586)
X-Accept-Language: en
MIME-Version: 1.0
To: jennifer75@example.com
Subject: Re: help with reqular expresion
References: <jennifer75@example.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N

here's a regular expression that I've come up with to parse HTTP urls
(i've modified it here slightly to also match FTP):

^((http|ftp){1}://)?[[:alnum:]_-]+\.([[:alnum:]_-]+\.)*[[:alpha:]]{2,3}(:[\d]{1,4})?(/.*)?$

i hope this helps you out

-kg


rob wrote:
> 
> im trying to come up with a working
> version of a reg expression that will match all links
> that are in the text of an email message.
> 
> ftp://.*
> http://.*
> mailto:.*
> 
> etc,
> 
> except
> 
> =http://images.blah.blah.net or
> ="http://images.blah.blah.net" or
> ='http://images.blah.blah.net'
> 
> this is what im coming up with
> 
> simpliest version
> [^=][http|ftp]*?://.*?[^ ]{0,}
> 
> im using the gui demo program for my testing.
> 
> this seems somewhat right, right?, excluding mailto: tags
> 
> maybe i am doing something wrong but that expression
> isnt working as i think it should.
> 
> i also noticed that [:space:] is not working correctly
> that is why i used [^ ] and also the negating at the
> beginning isnt working either??
> 
> any point in the right direction will be appreciated.

From regexp-user-jennifer75@example.com Mon May 21 23:44:20 2001
Return-Path: <regexp-user-jennifer75@example.com>
Delivered-To: jennifer75@example.com
Received: (qmail 1374 invoked by uid 500); 21 May 2001 23:44:11 -0000
Mailing-List: contact jennifer75@example.com; run by ezmlm
Precedence: bulk
Reply-To: jennifer75@example.com
list-help: <mailto:jennifer75@example.com>
list-unsubscribe: <mailto:jennifer75@example.com>
list-post: <mailto:jennifer75@example.com>
Delivered-To: mailing list jennifer75@example.com
Received: (qmail 1176 invoked from network); 21 May 2001 23:44:08 -0000
From: "Eric Goldberg" <jennifer75@example.com>
To: <jennifer75@example.com>
Subject: [:graph:]
Date: Mon, 21 May 2001 19:40:46 -0400
Message-ID: <jennifer75@example.com>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N

Hello list,

I am trying to write a re to match email addresses:

	r = new RE("^[:graph:]+@[:graph:]+\\.[:graph:]+$");

But this does not match on simple email addresses (e.g. jennifer75@example.com).
When I change the graph's to alnum's, it does match.

	r = new RE("^[:alnum:]+@[:alnum:]+\\.[:alnum:]+$");

My understanding is that graph includes all printable and visible characters
(i.e. alnum plus all punctuation).  Am I understanding graph incorrectly?
Has anyone else experienced unexpected results with [:graph:]?

--eric


From regexp-user-jennifer75@example.com Tue May 22 00:11:52 2001
Return-Path: <regexp-user-jennifer75@example.com>
Delivered-To: jennifer75@example.com
Received: (qmail 29137 invoked by uid 500); 22 May 2001 00:11:47 -0000
Mailing-List: contact jennifer75@example.com; run by ezmlm
Precedence: bulk
Reply-To: jennifer75@example.com
list-help: <mailto:jennifer75@example.com>
list-unsubscribe: <mailto:jennifer75@example.com>
list-post: <mailto:jennifer75@example.com>
Delivered-To: mailing list jennifer75@example.com
Received: (qmail 29118 invoked from network); 22 May 2001 00:11:45 -0000
Sender: kris
Message-ID: <jennifer75@example.com>
Date: Mon, 21 May 2001 18:08:27 -0500
From: Kris Gonzalez <jennifer75@example.com>
X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.14-5.0 i586)
X-Accept-Language: en
MIME-Version: 1.0
To: jennifer75@example.com
Subject: Re: [:graph:]
References: <jennifer75@example.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N

no experience with [:graph:], but i can probably help out your re a bit
in another way...

due to internic standards, domains must be alphanumeric and may include
a dash or underscore...also, the last part of an email with either be a
two- or three-digit alpha string...therefore, after your @, your re
might be more useful like this:

[[:alnum:]\._-]+\\.[[:alpha:]]{2,3}$





Eric Goldberg wrote:
> 
> Hello list,
> 
> I am trying to write a re to match email addresses:
> 
>         r = new RE("^[:graph:]+@[:graph:]+\\.[:graph:]+$");
> 
> But this does not match on simple email addresses (e.g. jennifer75@example.com).
> When I change the graph's to alnum's, it does match.
> 
>         r = new RE("^[:alnum:]+@[:alnum:]+\\.[:alnum:]+$");
> 
> My understanding is that graph includes all printable and visible characters
> (i.e. alnum plus all punctuation).  Am I understanding graph incorrectly?
> Has anyone else experienced unexpected results with [:graph:]?
> 
> --eric

From regexp-user-jennifer75@example.com Tue May 22 14:59:46 2001
Return-Path: <regexp-user-jennifer75@example.com>
Delivered-To: jennifer75@example.com
Received: (qmail 88128 invoked by uid 500); 22 May 2001 14:58:54 -0000
Mailing-List: contact jennifer75@example.com; run by ezmlm
Precedence: bulk
Reply-To: jennifer75@example.com
list-help: <mailto:jennifer75@example.com>
list-unsubscribe: <mailto:jennifer75@example.com>
list-post: <mailto:jennifer75@example.com>
Delivered-To: mailing list jennifer75@example.com
Received: (qmail 87636 invoked from network); 22 May 2001 14:58:31 -0000
From: "Eric Goldberg" <jennifer75@example.com>
To: <jennifer75@example.com>
Subject: RE: [:graph:]
Date: Tue, 22 May 2001 10:55:02 -0400
Message-ID: <jennifer75@example.com>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
In-Reply-To: <jennifer75@example.com>
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N

I appreciate your suggestion, Kris.  Thanks.

I had tried to find an online resource that explained the standards (if any)
for valid email addresses, but could not find anything of substance.  You
mentioned the internic standards for email addresses; are these standards
posted on the Web? (I looked on the internic.org site and could not find any
reference to email standards.)

Also, I read on the apache regexp page that nested posix character classes
are not supported and so I thought an expression like [[:alnum:]\._-] would
not work.  If I'm wrong here, then does anyone know what is meant by nested
character classes?


-----Original Message-----
From: jennifer75@example.com [mailto:jennifer75@example.com]On Behalf Of Kris Gonzalez
Sent: Monday, May 21, 2001 7:08 PM
To: jennifer75@example.com
Subject: Re: [:graph:]


no experience with [:graph:], but i can probably help out your re a bit
in another way...

due to internic standards, domains must be alphanumeric and may include
a dash or underscore...also, the last part of an email with either be a
two- or three-digit alpha string...therefore, after your @, your re
might be more useful like this:

[[:alnum:]\._-]+\\.[[:alpha:]]{2,3}$



From regexp-user-jennifer75@example.com Wed May 23 11:46:43 2001
Return-Path: <regexp-user-jennifer75@example.com>
Delivered-To: jennifer75@example.com
Received: (qmail 91021 invoked by uid 500); 23 May 2001 11:46:43 -0000
Mailing-List: contact jennifer75@example.com; run by ezmlm
Precedence: bulk
Reply-To: jennifer75@example.com
list-help: <mailto:jennifer75@example.com>
list-unsubscribe: <mailto:jennifer75@example.com>
list-post: <mailto:jennifer75@example.com>
Delivered-To: mailing list jennifer75@example.com
Received: (qmail 91012 invoked from network); 23 May 2001 11:46:42 -0000
Sender: kris
Message-ID: <jennifer75@example.com>
Date: Wed, 23 May 2001 05:43:18 -0500
From: Kris Gonzalez <jennifer75@example.com>
X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.14-5.0 i586)
X-Accept-Language: en
MIME-Version: 1.0
To: jennifer75@example.com
Subject: Re: [:graph:]
References: <jennifer75@example.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N

you're right about the nested posix character classes, i'd forgotten
about that...i pasted the regexp from a tcl application i'd written...i
referenced the java code where i'd implemented this and found that i'd
had to work around and use 0-9A-Z instead of [:alnum:]

-kg

Eric Goldberg wrote:
> 
> I appreciate your suggestion, Kris.  Thanks.
> 
> I had tried to find an online resource that explained the standards (if any)
> for valid email addresses, but could not find anything of substance.  You
> mentioned the internic standards for email addresses; are these standards
> posted on the Web? (I looked on the internic.org site and could not find any
> reference to email standards.)
> 
> Also, I read on the apache regexp page that nested posix character classes
> are not supported and so I thought an expression like [[:alnum:]\._-] would
> not work.  If I'm wrong here, then does anyone know what is meant by nested
> character classes?
> 
> -----Original Message-----
> From: jennifer75@example.com [mailto:jennifer75@example.com]On Behalf Of Kris Gonzalez
> Sent: Monday, May 21, 2001 7:08 PM
> To: jennifer75@example.com
> Subject: Re: [:graph:]
> 
> no experience with [:graph:], but i can probably help out your re a bit
> in another way...
> 
> due to internic standards, domains must be alphanumeric and may include
> a dash or underscore...also, the last part of an email with either be a
> two- or three-digit alpha string...therefore, after your @, your re
> might be more useful like this:
> 
> [[:alnum:]\._-]+\\.[[:alpha:]]{2,3}$

From regexp-user-jennifer75@example.com Wed May 23 13:27:49 2001
Return-Path: <regexp-user-jennifer75@example.com>
Delivered-To: jennifer75@example.com
Received: (qmail 12509 invoked by uid 500); 23 May 2001 13:27:37 -0000
Mailing-List: contact jennifer75@example.com; run by ezmlm
Precedence: bulk
Reply-To: jennifer75@example.com
list-help: <mailto:jennifer75@example.com>
list-unsubscribe: <mailto:jennifer75@example.com>
list-post: <mailto:jennifer75@example.com>
Delivered-To: mailing list jennifer75@example.com
Delivered-To: moderator for jennifer75@example.com
Received: (qmail 5730 invoked from network); 22 May 2001 21:11:07 -0000
From: "Michael McCallum" <jennifer75@example.com>
To: jennifer75@example.com
Date: Wed, 23 May 2001 09:10:42 +1200
MIME-Version: 1.0
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Subject: RE: [:graph:]
Reply-to: jennifer75@example.com
Message-ID: <3B0B7E92.30856.3D37D9A1@localhost>
Priority: normal
In-reply-to: <jennifer75@example.com>
References: <jennifer75@example.com>
X-mailer: Pegasus Mail for Win32 (v3.12c)
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N

On 22 May 2001, at 10:55, Eric Goldberg wrote:

> I appreciate your suggestion, Kris.  Thanks.
> 
> I had tried to find an online resource that explained the standards (if any)
> for valid email addresses, but could not find anything of substance.  You
> mentioned the internic standards for email addresses; are these standards
> posted on the Web? (I looked on the internic.org site and could not find any
> reference to email standards.)
try RFC 822 for a start.

> 
> Also, I read on the apache regexp page that nested posix character classes
> are not supported and so I thought an expression like [[:alnum:]\._-] would
> not work.  If I'm wrong here, then does anyone know what is meant by nested
> character classes?
I think it means [:[:foo:]:] but Id have to check the code.

> 
> 
> -----Original Message-----
> From: jennifer75@example.com [mailto:jennifer75@example.com]On Behalf Of Kris Gonzalez
> Sent: Monday, May 21, 2001 7:08 PM
> To: jennifer75@example.com
> Subject: Re: [:graph:]
> 
> 
> no experience with [:graph:], but i can probably help out your re a bit
> in another way...
> 
> due to internic standards, domains must be alphanumeric and may include
> a dash or underscore...also, the last part of an email with either be a
> two- or three-digit alpha string...therefore, after your @, your re
> might be more useful like this:
> 
> [[:alnum:]\._-]+\\.[[:alpha:]]{2,3}$
> 
> 



From regexp-user-jennifer75@example.com Thu May 31 11:48:46 2001
Return-Path: <regexp-user-jennifer75@example.com>
Delivered-To: jennifer75@example.com
Received: (qmail 42244 invoked by uid 500); 31 May 2001 11:48:31 -0000
Mailing-List: contact jennifer75@example.com; run by ezmlm
Precedence: bulk
Reply-To: jennifer75@example.com
list-help: <mailto:jennifer75@example.com>
list-unsubscribe: <mailto:jennifer75@example.com>
list-post: <mailto:jennifer75@example.com>
Delivered-To: mailing list jennifer75@example.com
Received: (qmail 42222 invoked from network); 31 May 2001 11:48:25 -0000
Message-Id: <jennifer75@example.com>
From: "Edward Q. Bridges" <jennifer75@example.com>
To: "jennifer75@example.com" <jennifer75@example.com>
Date: Thu, 31 May 2001 13:48:18 +0200
Reply-To: "Edward Q. Bridges" <jennifer75@example.com>
Priority: Normal
X-Mailer: PMMail 2000 Professional (2.10.2010) For Windows 2000 (5.0.2195)
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Subject: possible bug?
X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N

When i compile this regexp:
	([\w\d\-\/]+?)\s+([\w\d\.\-]+) 
using org.apache.regexp.recompile, and
use it to match this string:
	X11; I; Linux 2.0.32 i586

i get the following for the output representing the first
and second parenthesis:
OS: Linux 
Version: 2

When i do this in a perl script (see below) i
get the following (which is the desired result):
OS: Linux
Version: 2.0.32

Any ideas?  am i wrong in assuming that the regexp syntax
is compatible with perl's syntax?

thanks
--e--


below is the compiled regexp, and beneath that, how i use it.

/** 
 * Extracts the name and version number of the operating 
 * system when there's a space between them.
 *
 * <p><code> ([\w\d\-\/]+?)\s+([\w\d\.\-]+) </code></p>
 */
final static char[] extractOS_osversion_spaces =
{
    0x007c, 0x0000, 0x0052, 0x0028, 0x0001, 0x0003, 0x007c,
    0x0000, 0x0018, 0x003d, 0x0000, 0x0015, 0x005b, 0x0006,
    0x000f, 0x0061, 0x007a, 0x0041, 0x005a, 0x005f, 0x005f,
    0x0030, 0x0039, 0x002d, 0x002d, 0x002f, 0x002f, 0x0045,
    0x0000, 0x0000, 0x0029, 0x0001, 0x0003, 0x005c, 0x0073,
    0x0003, 0x007c, 0x0000, 0x0006, 0x0047, 0x0000, 0xfffa,
    0x007c, 0x0000, 0x0003, 0x004e, 0x0000, 0x0003, 0x0028,
    0x0002, 0x0003, 0x007c, 0x0000, 0x001c, 0x005b, 0x0005,
    0x000d, 0x0061, 0x007a, 0x0041, 0x005a, 0x005f, 0x005f,
    0x0030, 0x0039, 0x002d, 0x002d, 0x007c, 0x0000, 0x0006,
    0x0047, 0x0000, 0xfff0, 0x007c, 0x0000, 0x0003, 0x004e,
    0x0000, 0x0003, 0x0029, 0x0002, 0x0003, 0x0045, 0x0000,
    0x0000,
};

.
.
.
pattern = new RE( new REProgram(extractOS_osversion_spaces) );
if ( pattern.match(s) ) {
    os = pattern.getParen(1);
    os_version = pattern.getParen(2);
    System.out.println("OS: " + os + "\nVersion: " + os_version);
}
.
.
.


Here's the perl script:

$ua = 'X11; I; Linux 2.0.32 i586';
$ua =~ m#([\w\d\-\/]+?)\s+([\w\d\.\-]+)#;

print "OS: " . $1 . "\n";
print "Version: " . $2 . "\n";





--------------------------------------------
<argo_tec gmbh>
     ed.q.bridges
     tel. 089-368179.xx / fax 089-368179.79
     osterwaldstrasse 10 / 80805 muenchen
</argo_tec gmbh>
--------------------------------------------  




{'source': 'Apache Software Foundation Public Mail Archives'}