Any ideas on this RegExp?
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngregexp' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Dwight H. Barbour (VIP)
Is there anything in RegExp that would work for the following?
=20
Want to let everything pass thru, EXCEPT the word JAVA (no need to be
careful regarding case sensitivity).=20
=20
The RegExp should *NOT match* the following: (it's important that ONLY
this one *NOT match*)
The language is: JAVA
=20
The RegExp should *match* the following:
The language is: C
The language is: VB.NET
The language is: Pascal
The language is: COBOL
=20
The RegExp should *match* potential new languages such as:
The language is: JAVA1
The language is: myJAVA
The language is:=20
The language is:=20
=20
I hope this makes sense. I'm not actually working on an asp.net
project, but am working on the Lyris listserve software for
aspfriends.com.
=20
Thanks.
Dwight.
=20

Reply to this message...
 
    
Scott Mitchell (VIP)
Why in the world would you use a RegExp to do this? Just use InStr (or
the .NET equivlatnet, IndexOf) and search for JAVA. Wouldn't this be
much simpler than using a regexp?

Scott Mitchell
Click here to reveal e-mail address

***********************************************************

Looking for an on-line forum application to use in your ASP.NET Web
site? Your search is over! Download WebForums.NET today, the *first*
ASP.NET on-line forum system:
http://www.WebForumsSoftware.net/

********************************************

| -----Original Message-----
| From: Dwight H. Barbour [mailto:Click here to reveal e-mail address]
| Sent: Sunday, January 06, 2002 9:51 PM
| To: aspngregexp
| Subject: [aspngregexp] Any ideas on this RegExp?
|
|
| Is there anything in RegExp that would work for the following?
|
| Want to let everything pass thru, EXCEPT the word JAVA (no need to be
| careful regarding case sensitivity).
|
| The RegExp should *NOT match* the following: (it's important
| that ONLY
| this one *NOT match*)
| The language is: JAVA
|
| The RegExp should *match* the following:
| The language is: C
| The language is: VB.NET
| The language is: Pascal
| The language is: COBOL
|
| The RegExp should *match* potential new languages such as:
| The language is: JAVA1
| The language is: myJAVA
| The language is:
| The language is:
|
| I hope this makes sense. I'm not actually working on an asp.net
| project, but am working on the Lyris listserve software for
| aspfriends.com.
|
| Thanks.
| Dwight.
|
|
| | [aspngregexp] member Click here to reveal e-mail address = YOUR ID
| | http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT
| | http://www.asplists.com/search = SEARCH Archives
|
|

Reply to this message...
 
    
Dwight H. Barbour (VIP)

Scott, I agree with you! =20

However, this isn't a program I'm writing, just need a little help with
writing a RegExp.

The interface accepts two types of input:

1. exact text match (=3D)
2. regular expression

Dwight.

-----Original Message-----
From: Scott Mitchell [mailto:Click here to reveal e-mail address]
Sent: Monday, January 07, 2002 1:53 AM
To: aspngregexp
Subject: [aspngregexp] RE: Any ideas on this RegExp?

Why in the world would you use a RegExp to do this? Just use InStr (or
the .NET equivlatnet, IndexOf) and search for JAVA. Wouldn't this be
much simpler than using a regexp?

Scott Mitchell
Click here to reveal e-mail address

***********************************************************

Looking for an on-line forum application to use in your ASP.NET Web
site? Your search is over! Download WebForums.NET today, the *first*
ASP.NET on-line forum system:
http://www.WebForumsSoftware.net/

********************************************

| -----Original Message-----
| From: Dwight H. Barbour [mailto:Click here to reveal e-mail address]
| Sent: Sunday, January 06, 2002 9:51 PM
| To: aspngregexp
| Subject: [aspngregexp] Any ideas on this RegExp?
|
|
| Is there anything in RegExp that would work for the following?
|
| Want to let everything pass thru, EXCEPT the word JAVA (no need to be
| careful regarding case sensitivity).
|
| The RegExp should *NOT match* the following: (it's important
| that ONLY
| this one *NOT match*)
| The language is: JAVA
|
| The RegExp should *match* the following:
| The language is: C
| The language is: VB.NET
| The language is: Pascal
| The language is: COBOL
|
| The RegExp should *match* potential new languages such as:
| The language is: JAVA1
| The language is: myJAVA
| The language is:
| The language is:
|
| I hope this makes sense. I'm not actually working on an asp.net
| project, but am working on the Lyris listserve software for
| aspfriends.com.
|
| Thanks.
| Dwight.
|
|
| | [aspngregexp] member Click here to reveal e-mail address =3D YOUR ID
| | http://www.asplists.com/asplists/aspngregexp.asp =3D JOIN/QUIT
| | http://www.asplists.com/search =3D SEARCH Archives
|
|

| [aspngregexp] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspngregexp.asp =3D JOIN/QUIT
| http://www.asplists.com/search =3D SEARCH Archives

Reply to this message...
 
    
Scott Mitchell (VIP)
I don't know of a way to say: "Don't match this pattern." I know how to
instruct a regexp not to match certain characters or character ranges -
[^a-z], for example, will match strings NOT containing characters a to
z.

You may be up sh!t creek here. Hrmmm... maybe not. I guess this might
work:

^[^j][^a][^v][^a]$

totally untested, but it just may work, although, to be honest, I
wouldn't be surprised if it didn't! :)

Scott Mitchell
Click here to reveal e-mail address
http://www.4GuysFromRolla.com/
http://www.ASPMessageboard.com/
http://www.ASPFAQs.com/

* When you think ASP, think 4GuysFromRolla.com!

| -----Original Message-----
| From: Dwight H. Barbour [mailto:Click here to reveal e-mail address]
| Sent: Sunday, January 06, 2002 11:00 PM
| To: aspngregexp
| Subject: [aspngregexp] RE: Any ideas on this RegExp?
|
|
|
| Scott, I agree with you!
|
| However, this isn't a program I'm writing, just need a little
| help with
| writing a RegExp.
|
| The interface accepts two types of input:
|
| 1. exact text match (=)
| 2. regular expression
|
| Dwight.
|
| -----Original Message-----
| From: Scott Mitchell [mailto:Click here to reveal e-mail address]
| Sent: Monday, January 07, 2002 1:53 AM
| To: aspngregexp
| Subject: [aspngregexp] RE: Any ideas on this RegExp?
|
|
| Why in the world would you use a RegExp to do this? Just use
| InStr (or
| the .NET equivlatnet, IndexOf) and search for JAVA. Wouldn't this be
| much simpler than using a regexp?
|
| Scott Mitchell
| Click here to reveal e-mail address
|
|
| ***********************************************************
|
| Looking for an on-line forum application to use in your ASP.NET Web
| site? Your search is over! Download WebForums.NET today, the *first*
| ASP.NET on-line forum system:
| http://www.WebForumsSoftware.net/
|
| ********************************************
|
| | -----Original Message-----
| | From: Dwight H. Barbour [mailto:Click here to reveal e-mail address]
| | Sent: Sunday, January 06, 2002 9:51 PM
| | To: aspngregexp
| | Subject: [aspngregexp] Any ideas on this RegExp?
| |
| |
| | Is there anything in RegExp that would work for the following?
| |
| | Want to let everything pass thru, EXCEPT the word JAVA (no
| need to be
| | careful regarding case sensitivity).
| |
| | The RegExp should *NOT match* the following: (it's important
| | that ONLY
| | this one *NOT match*)
| | The language is: JAVA
| |
| | The RegExp should *match* the following:
| | The language is: C
| | The language is: VB.NET
| | The language is: Pascal
| | The language is: COBOL
| |
| | The RegExp should *match* potential new languages such as:
| | The language is: JAVA1
| | The language is: myJAVA
| | The language is:
| | The language is:
| |
| | I hope this makes sense. I'm not actually working on an asp.net
| | project, but am working on the Lyris listserve software for
| | aspfriends.com.
| |
| | Thanks.
| | Dwight.
| |
| |
| | | [aspngregexp] member Click here to reveal e-mail address = YOUR ID
| | | http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT
| | | http://www.asplists.com/search = SEARCH Archives
| |
| |
|
|
| | [aspngregexp] member Click here to reveal e-mail address = YOUR ID
| | http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT
| | http://www.asplists.com/search = SEARCH Archives
|
|
| | [aspngregexp] member Click here to reveal e-mail address = YOUR ID
| | http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT
| | http://www.asplists.com/search = SEARCH Archives
|
|

Reply to this message...
 
    
Dwight H. Barbour (VIP)

That's what i've been working with [^j]. Had hopped for a better
solution. Maybe someone else on the list will have some ideas.

This thinking in reverse logic isn't the easiest.

No sh!t creek here.. there will be a solution!

Thanks.
Dwight.

-----Original Message-----
From: Scott Mitchell [mailto:Click here to reveal e-mail address]
Sent: Monday, January 07, 2002 2:58 AM
To: aspngregexp
Subject: [aspngregexp] RE: Any ideas on this RegExp?

I don't know of a way to say: "Don't match this pattern." I know how to
instruct a regexp not to match certain characters or character ranges -
[^a-z], for example, will match strings NOT containing characters a to
z.

You may be up sh!t creek here. Hrmmm... maybe not. I guess this might
work:

^[^j][^a][^v][^a]$

totally untested, but it just may work, although, to be honest, I
wouldn't be surprised if it didn't! :)

Scott Mitchell
Click here to reveal e-mail address
http://www.4GuysFromRolla.com/
http://www.ASPMessageboard.com/
http://www.ASPFAQs.com/

* When you think ASP, think 4GuysFromRolla.com!

| -----Original Message-----
| From: Dwight H. Barbour [mailto:Click here to reveal e-mail address]
| Sent: Sunday, January 06, 2002 11:00 PM
| To: aspngregexp
| Subject: [aspngregexp] RE: Any ideas on this RegExp?
|
|
|
| Scott, I agree with you!
|
| However, this isn't a program I'm writing, just need a little
| help with
| writing a RegExp.
|
| The interface accepts two types of input:
|
| 1. exact text match (=3D)
| 2. regular expression
|
| Dwight.
|
| -----Original Message-----
| From: Scott Mitchell [mailto:Click here to reveal e-mail address]
| Sent: Monday, January 07, 2002 1:53 AM
| To: aspngregexp
| Subject: [aspngregexp] RE: Any ideas on this RegExp?
|
|
| Why in the world would you use a RegExp to do this? Just use
| InStr (or
| the .NET equivlatnet, IndexOf) and search for JAVA. Wouldn't this be
| much simpler than using a regexp?
|
| Scott Mitchell
| Click here to reveal e-mail address
|
|
| ***********************************************************
|
| Looking for an on-line forum application to use in your ASP.NET Web
| site? Your search is over! Download WebForums.NET today, the *first*
| ASP.NET on-line forum system:
| http://www.WebForumsSoftware.net/
|
| ********************************************
|
| | -----Original Message-----
| | From: Dwight H. Barbour [mailto:Click here to reveal e-mail address]
| | Sent: Sunday, January 06, 2002 9:51 PM
| | To: aspngregexp
| | Subject: [aspngregexp] Any ideas on this RegExp?
| |
| |
| | Is there anything in RegExp that would work for the following?
| |
| | Want to let everything pass thru, EXCEPT the word JAVA (no
| need to be
| | careful regarding case sensitivity).
| |
| | The RegExp should *NOT match* the following: (it's important
| | that ONLY
| | this one *NOT match*)
| | The language is: JAVA
| |
| | The RegExp should *match* the following:
| | The language is: C
| | The language is: VB.NET
| | The language is: Pascal
| | The language is: COBOL
| |
| | The RegExp should *match* potential new languages such as:
| | The language is: JAVA1
| | The language is: myJAVA
| | The language is:
| | The language is:
| |
| | I hope this makes sense. I'm not actually working on an asp.net
| | project, but am working on the Lyris listserve software for
| | aspfriends.com.
| |
| | Thanks.
| | Dwight.
| |
| |
| | | [aspngregexp] member Click here to reveal e-mail address =3D YOUR ID
| | | http://www.asplists.com/asplists/aspngregexp.asp =3D JOIN/QUIT
| | | http://www.asplists.com/search =3D SEARCH Archives
| |
| |
|
|
| | [aspngregexp] member Click here to reveal e-mail address =3D YOUR ID
| | http://www.asplists.com/asplists/aspngregexp.asp =3D JOIN/QUIT
| | http://www.asplists.com/search =3D SEARCH Archives
|
|
| | [aspngregexp] member Click here to reveal e-mail address =3D YOUR ID
| | http://www.asplists.com/asplists/aspngregexp.asp =3D JOIN/QUIT
| | http://www.asplists.com/search =3D SEARCH Archives
|
|

| [aspngregexp] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspngregexp.asp =3D JOIN/QUIT
| http://www.asplists.com/search =3D SEARCH Archives

Reply to this message...
 
    
Scott Mitchell (VIP)
The proposed regexp I provided didn't work?

| -----Original Message-----
| From: Dwight H. Barbour [mailto:Click here to reveal e-mail address]
| Sent: Monday, January 07, 2002 12:07 AM
| To: aspngregexp
| Subject: [aspngregexp] RE: Any ideas on this RegExp?
|
|
|
| That's what i've been working with [^j]. Had hopped for a better
| solution. Maybe someone else on the list will have some ideas.
|
| This thinking in reverse logic isn't the easiest.
|
| No sh!t creek here.. there will be a solution!
|
| Thanks.
| Dwight.
|
|
| -----Original Message-----
| From: Scott Mitchell [mailto:Click here to reveal e-mail address]
| Sent: Monday, January 07, 2002 2:58 AM
| To: aspngregexp
| Subject: [aspngregexp] RE: Any ideas on this RegExp?
|
|
| I don't know of a way to say: "Don't match this pattern." I
| know how to
| instruct a regexp not to match certain characters or
| character ranges -
| [^a-z], for example, will match strings NOT containing characters a to
| z.
|
| You may be up sh!t creek here. Hrmmm... maybe not. I guess
| this might
| work:
|
| ^[^j][^a][^v][^a]$
|
| totally untested, but it just may work, although, to be honest, I
| wouldn't be surprised if it didn't! :)
|
| Scott Mitchell
| Click here to reveal e-mail address
| http://www.4GuysFromRolla.com/
| http://www.ASPMessageboard.com/
| http://www.ASPFAQs.com/
|
| * When you think ASP, think 4GuysFromRolla.com!
|
|
| | -----Original Message-----
| | From: Dwight H. Barbour [mailto:Click here to reveal e-mail address]
| | Sent: Sunday, January 06, 2002 11:00 PM
| | To: aspngregexp
| | Subject: [aspngregexp] RE: Any ideas on this RegExp?
| |
| |
| |
| | Scott, I agree with you!
| |
| | However, this isn't a program I'm writing, just need a little
| | help with
| | writing a RegExp.
| |
| | The interface accepts two types of input:
| |
| | 1. exact text match (=)
| | 2. regular expression
| |
| | Dwight.
| |
| | -----Original Message-----
| | From: Scott Mitchell [mailto:Click here to reveal e-mail address]
| | Sent: Monday, January 07, 2002 1:53 AM
| | To: aspngregexp
| | Subject: [aspngregexp] RE: Any ideas on this RegExp?
| |
| |
| | Why in the world would you use a RegExp to do this? Just use
| | InStr (or
| | the .NET equivlatnet, IndexOf) and search for JAVA.
| Wouldn't this be
| | much simpler than using a regexp?
| |
| | Scott Mitchell
| | Click here to reveal e-mail address
| |
| |
| | ***********************************************************
| |
| | Looking for an on-line forum application to use in your ASP.NET Web
| | site? Your search is over! Download WebForums.NET today,
| the *first*
| | ASP.NET on-line forum system:
| | http://www.WebForumsSoftware.net/
| |
| | ********************************************
| |
| | | -----Original Message-----
| | | From: Dwight H. Barbour [mailto:Click here to reveal e-mail address]
| | | Sent: Sunday, January 06, 2002 9:51 PM
| | | To: aspngregexp
| | | Subject: [aspngregexp] Any ideas on this RegExp?
| | |
| | |
| | | Is there anything in RegExp that would work for the following?
| | |
| | | Want to let everything pass thru, EXCEPT the word JAVA (no
| | need to be
| | | careful regarding case sensitivity).
| | |
| | | The RegExp should *NOT match* the following: (it's important
| | | that ONLY
| | | this one *NOT match*)
| | | The language is: JAVA
| | |
| | | The RegExp should *match* the following:
| | | The language is: C
| | | The language is: VB.NET
| | | The language is: Pascal
| | | The language is: COBOL
| | |
| | | The RegExp should *match* potential new languages such as:
| | | The language is: JAVA1
| | | The language is: myJAVA
| | | The language is:
| | | The language is:
| | |
| | | I hope this makes sense. I'm not actually working on an asp.net
| | | project, but am working on the Lyris listserve software for
| | | aspfriends.com.
| | |
| | | Thanks.
| | | Dwight.
| | |
| | |
| | | | [aspngregexp] member Click here to reveal e-mail address = YOUR ID
| | | | http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT
| | | | http://www.asplists.com/search = SEARCH Archives
| | |
| | |
| |
| |
| | | [aspngregexp] member Click here to reveal e-mail address = YOUR ID
| | | http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT
| | | http://www.asplists.com/search = SEARCH Archives
| |
| |
| | | [aspngregexp] member Click here to reveal e-mail address = YOUR ID
| | | http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT
| | | http://www.asplists.com/search = SEARCH Archives
| |
| |
|
|
| | [aspngregexp] member Click here to reveal e-mail address = YOUR ID
| | http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT
| | http://www.asplists.com/search = SEARCH Archives
|
|
| | [aspngregexp] member Click here to reveal e-mail address = YOUR ID
| | http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT
| | http://www.asplists.com/search = SEARCH Archives
|

Reply to this message...
 
    
Ryan Trudelle-Schwarz (VIP)
Ok, so what's the prize for getting it? ;)

Check the following:
@"\A(?!java\z).*?"

Results:
Testing "java": False
Testing "CSharp": True
Testing "javascript": True
Testing "myJava": True
Testing "Pascal": True
Testing "VB.Net": True
Testing "C": True

:)

hth, Ryan

-----Original Message-----
From: Scott Mitchell [mailto:Click here to reveal e-mail address]

The proposed regexp I provided didn't work?

| -----Original Message-----
| From: Dwight H. Barbour [mailto:Click here to reveal e-mail address]
|
| That's what i've been working with [^j]. Had hopped for a better
| solution. Maybe someone else on the list will have some ideas.
|
| This thinking in reverse logic isn't the easiest.
|
| No sh!t creek here.. there will be a solution!
|
| Thanks.
| Dwight.
|
|
| -----Original Message-----
| From: Scott Mitchell [mailto:Click here to reveal e-mail address]
|
| I don't know of a way to say: "Don't match this pattern." I
| know how to
| instruct a regexp not to match certain characters or
| character ranges -
| [^a-z], for example, will match strings NOT containing characters a to
| z.
|
| You may be up sh!t creek here. Hrmmm... maybe not. I guess
| this might
| work:
|
| ^[^j][^a][^v][^a]$
|
| totally untested, but it just may work, although, to be honest, I
| wouldn't be surprised if it didn't! :)
|
| Scott Mitchell
|
| | -----Original Message-----
| | From: Dwight H. Barbour [mailto:Click here to reveal e-mail address]
| |
| | Scott, I agree with you!
| |
| | However, this isn't a program I'm writing, just need a little
| | help with
| | writing a RegExp.
| |
| | The interface accepts two types of input:
| |
| | 1. exact text match (=)
| | 2. regular expression
| |
| | Dwight.
| |
| | -----Original Message-----
| | From: Scott Mitchell [mailto:Click here to reveal e-mail address]
| |
| | Why in the world would you use a RegExp to do this? Just use
| | InStr (or
| | the .NET equivlatnet, IndexOf) and search for JAVA.
| Wouldn't this be
| | much simpler than using a regexp?
| |
| | Scott Mitchell
| |
| | | -----Original Message-----
| | | From: Dwight H. Barbour [mailto:Click here to reveal e-mail address]
| | |
| | | Is there anything in RegExp that would work for the following?
| | |
| | | Want to let everything pass thru, EXCEPT the word JAVA (no
| | need to be
| | | careful regarding case sensitivity).
| | |
| | | The RegExp should *NOT match* the following: (it's important
| | | that ONLY
| | | this one *NOT match*)
| | | The language is: JAVA
| | |
| | | The RegExp should *match* the following:
| | | The language is: C
| | | The language is: VB.NET
| | | The language is: Pascal
| | | The language is: COBOL
| | |
| | | The RegExp should *match* potential new languages such as:
| | | The language is: JAVA1
| | | The language is: myJAVA
| | | The language is:
| | | The language is:
| | |
| | | I hope this makes sense. I'm not actually working on an asp.net
| | | project, but am working on the Lyris listserve software for
| | | aspfriends.com.
| | |
| | | Thanks.
| | | Dwight.

Reply to this message...
 
 




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com