Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > BOOK: Beginning Regular Expressions
|
BOOK: Beginning Regular Expressions
This is the forum to discuss the Wrox book Beginning Regular Expressions by Andrew Watt; ISBN: 9780764574894
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Regular Expressions section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 27th, 2006, 06:49 AM
Registered User
 
Join Date: May 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Regular expression to select non-matching pattern

Hi All,

I am new to regular expressions so this may be very basic.
I want to select lines containing non-matching pattern.

For example:
London
NewYork
Delhi
Mountainview

If above are the given then I want cities except "Delhi"

Please suggest. Thanks.

 
Old June 12th, 2006, 10:06 AM
Registered User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

// Any character not in "Delhi"
Regex regex = new Regex(@"[^Delhi]",
            RegexOptions.IgnoreCase |
            RegexOptions.Multiline);

Sample Run:
Matching: London
Matching: NewYork
Matching: Delhi
    No Match
Matching: Mountainview








Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expression matching sub string mayasht Pro Java 3 August 8th, 2007 05:32 AM
javascript pattern matching... rbd Javascript 1 October 7th, 2004 12:20 PM
PHP Pattern Matching joanncae BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 May 17th, 2004 04:52 PM
Pattern Matching using PHP spraveens PHP Databases 2 March 23rd, 2004 10:03 PM
regular expression pattern... lukemedway_uk Classic ASP Basics 1 December 3rd, 2003 11:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.