Solved

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

Posted on 2008-10-31
3
433 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
[X]
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
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

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

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

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…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

734 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