473,394 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Non matching regex?

Max
Anyone knows how to create a regex expression that matches all strings not
containing a specific word?
I thought the following would work but i dows not.

Dim TestRegex As Regex = New Regex("(?!exp).*")
Dim S As String = "exp"

Dim M As Match = TestRegex.Match(S)

If M.Success Then
Debug.Write("Match")
Else
Debug.Write("No Match")
End If
Nov 21 '05 #1
2 1192
I think you are looking for the ^ operator.

"Max" <Ma*@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
Anyone knows how to create a regex expression that matches all strings not
containing a specific word?
I thought the following would work but i dows not.

Dim TestRegex As Regex = New Regex("(?!exp).*")
Dim S As String = "exp"

Dim M As Match = TestRegex.Match(S)

If M.Success Then
Debug.Write("Match")
Else
Debug.Write("No Match")
End If

Nov 21 '05 #2
I think you are looking for the ^ operator.

"Max" <Ma*@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
Anyone knows how to create a regex expression that matches all strings not
containing a specific word?
I thought the following would work but i dows not.

Dim TestRegex As Regex = New Regex("(?!exp).*")
Dim S As String = "exp"

Dim M As Match = TestRegex.Match(S)

If M.Success Then
Debug.Write("Match")
Else
Debug.Write("No Match")
End If

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # Matching string patterns # # Sometimes you want to know if a string is of # particular pattern. Let's say in your website # you have converted all images...
3
by: Day Of The Eagle | last post by:
Jeff_Relf wrote: > ...yet you don't even know what RegEx is. > I'm looking at the source code for mono's Regex implementation right now. You can download that source here ( use the class...
9
by: Martijn | last post by:
Hi, Which is the prevalent way of matching a filename to a mask in runtime? The best I can think of, is sscanf. Thanks for the help! <OT> It's for the Windows platform, so any functions...
2
by: RobC | last post by:
I have noticed that in the directoryInfo class a method named GetFiles(String) accepts a wildcard pattern as a parameter and uses this to match file names that exist in a directory. I want to use...
5
by: olaufr | last post by:
Hi, I'd need to perform simple pattern matching within a string using a list of possible patterns. For example, I want to know if the substring starting at position n matches any of the string I...
7
by: Kevin CH | last post by:
Hi, I'm currently running into a confusion on regex and hopefully you guys can clear it up for me. Suppose I have a regular expression (0|(1(01*0)*1))* and two test strings: 110_1011101_ and...
8
by: Xah Lee | last post by:
the Python regex documentation is available at: http://xahlee.org/perl-python/python_re-write/lib/module-re.html Note that, i've just made the terms of use clear. Also, can anyone answer what...
0
by: Tidane | last post by:
Visual Basic.NET Framework 2.0 I've created a program to parse out text as the program recieved it and use Regex matching to decide what should be done. My problem is that the text is matching when...
11
by: tech | last post by:
Hi, I need a function to specify a match pattern including using wildcard characters as below to find chars in a std::string. The match pattern can contain the wildcard characters "*" and "?",...
1
by: Joe Strout | last post by:
Wow, this was harder than I thought (at least for a rusty Pythoneer like myself). Here's my stab at an implementation. Remember, the goal is to add a "match" method to Template which works like...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.