Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Help with an "string" exclusion with Regular Expression...

Posted on 2008-10-31
3
429 Views
Last Modified: 2010-04-21
Hello.

I have an application where I am opening defining a set of URLs but want to exclude a few...

Here is my current expression:
.*\.(ITC|HTC)\.localhost\.com.*

This is an open expression that is allowing anything...  a-z 0 - 9 special chars....ITC.localhost.com... etcc.
but i want to exclude the word test.    so i dont want the expression to include  ... test.itc.localhost.com

Please assist... Thank you



0
Comment
Question by:dstwins
3 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 22854602
(?!.*test).*\.(ITC|HTC)\.localhost\.com.*
0
 
LVL 4

Accepted Solution

by:
SyfAldeen earned 500 total points
ID: 22884511
dstwins,
Kindly, check the following RegEx.
Applying this RegEx to:
Any.ITC.localhost.com
test.itc.localhost.com

The result will be:
(Any.ITC.localhost.com)
(.itc.localhost.com)
 

(?!t)(?!e)(?!s)(?!t).*\.(?:ITC|HTC)\.localhost\.com.*

Open in new window

0
 

Author Closing Comment

by:dstwins
ID: 31512223
Thank you this has worked well for me...
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Whatever be the reason, if you are working on web development side,  you will need day-today validation codes like email validation, date validation , IP address validation, phone validation on any of the edit page or say at the time of registration…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question