p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Other Programming > BOOK: Beginning Regular Expressions
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 27th, 2009, 05:30 AM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default RegEx to match a string only if it does'nt have a particular string within it

Hi All
Requesting help on this one. I am working on a JAVA based tool 'webMethods' which provides built-in functionality to replace char/string from a given input, it also excepts RegEx to match the search string.
My requirement to create a RegEx which can be supplied to the above built-in functionality to match any string (that can contain new lines and other white space characters) only if it doesnt have a particular word say BRANCH.
Examples of positive matches can be-
  • The bank of America.
  • The #123 bank.
  • @$%# (*%&.
Examples of negative matches can be-
  • BRANCH
  • The #123 BRANCH of this bank.
  • This is the last BRANCH.
  • BRANCH BRANCH
I tried using the expression [\s\S\s]*(?!BRANCH)[\s\S\s]*, but this does'nt work for all the scenarios.

Thanks !!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old January 27th, 2009, 05:17 PM
Friend of Wrox
Points: 4,805, Level: 29
Points: 4,805, Level: 29 Points: 4,805, Level: 29 Points: 4,805, Level: 29
Activity: 38%
Activity: 38% Activity: 38% Activity: 38%
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,323
Thanks: 3
Thanked 70 Times in 69 Posts
Default

Well, not to ask a silly question, but...

Why not simply BRANCH for the RegExp and then just test for *NOT* matching instead of for matching in the Java code????
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
STRING EXACT MATCH ricespn Beginning VB 6 6 November 12th, 2007 01:18 PM
need to match string dynamically dipsut XSLT 2 May 25th, 2007 09:49 AM
use regex to split string store in dictionary edman747 VB How-To 0 January 29th, 2007 12:02 AM
match string in more than one line using Regex suman9730 General .NET 0 October 24th, 2006 03:27 AM
Compier Error: procedure decleration does'nt match haahoou Beginning VB 6 2 January 20th, 2004 03:10 AM



All times are GMT -4. The time now is 04:41 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc