Solved

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

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
excel file 5 72
copy-item script help 15 77
Regular Expression Calculator Tester 2 72
Interactive Script in Scheduled Task not running 8 30
I have been reconstructing a PHP-based application that has grown into a full blown interface system over the last ten years by a developer that has now gone into business for himself building websites. I am not incredibly fond of writing PHP code o…
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 viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

770 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