Solved

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

Posted on 2008-10-31
3
426 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now