Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2008-10-31
3
Medium Priority
?
448 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 85

Expert Comment

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

Accepted Solution

by:
SyfAldeen earned 1500 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

972 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