Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

RegEx - select NOT <some string>
What's the syntax for RegEx to specify that I want to match something that's
NOT a string I specify?
Example: "HELLO WORLD"
RegEx (wanted) = select string that is NOT "WORLD"
Result: "HELLO "



Report this thread to moderator Post Follow-up to this message
Old Post
Art
04-28-05 01:55 AM


RE: RegEx - select NOT <some string>
Your example looks more like you want to remove a substring from a string
rather than select a string

Result = Replace("HELLO WORLD", "WORLD", "")

Is this what you mean?


"Art" wrote:

> What's the syntax for RegEx to specify that I want to match something that
's
> NOT a string I specify?
> Example: "HELLO WORLD"
> RegEx (wanted) = select string that is NOT "WORLD"
> Result: "HELLO "
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Charlie
04-28-05 01:55 AM


RE: RegEx - select NOT <some string>
Sorry I couldn't reply sooner.  My IE browser quit displaying the
threads..."error on page"  don't know why.  I finally loaded FireFox (agains
t
Company rules, but so what)

Without seeing exactly what you are trying to do I'm somewhat at a loss.  I
haven't ever used regular expressions.  There may be a pattern syntax that
does what you want.  I thought somebody else might've replied by now.

How would I do it?  The old fashion way... I'd probably break up processing
the string into several steps or loops to remove what I want removed using
the Replace function, or manually, etc.  Maybe not slick but if it gets the
job done...who knows maybe I'd get a pay raise!  (Yeah, right)


"Art" wrote:

> Charlie,
> Unfortunately not. I specifically simplified this regex to make my questio
n
> easily understood. The procesing instructions for the string in question a
re
> far more complicated and trying to illustrate it w/ concrete regex can be
> difficult to decrypt. So I thought that if I present the opposite then it
> will be easy to understand.
> Basically regex will have to replace all non-alphanumeric characters BUT
> will also have to bypass the patterns which I would specify.
> I know how to negate individual (or set of) characters but how can you
> accomplish the same w/ whole strings?
> For example I can't say regex = [^WORLD] becuse the result is going to be 
HE
> instead of HELLO. So, how do you negate whole strings instead of individua
l
> charactes.
> Thanks for you help thou!
>
> "Charlie" wrote:
> 

Report this thread to moderator Post Follow-up to this message
Old Post
Charlie
04-29-05 01:55 AM


Re: RegEx - select NOT <some string>
Use regex replace - set the regex syntax such that it finds the things you
want to eliminate and replace them with "".

"Art" <Art@discussions.microsoft.com> wrote in message
news:E3D45237-CE29-4C42-B5B6-66591BDA3A4A@microsoft.com...
> What's the syntax for RegEx to specify that I want to match something
> that's
> NOT a string I specify?
> Example: "HELLO WORLD"
> RegEx (wanted) = select string that is NOT "WORLD"
> Result: "HELLO "
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Bonj
04-29-05 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Basic archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:29 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.