473,508 Members | 2,434 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Regular Expressions Pattern Question

Hi Folks,

I have little knowledge of regular expressions but I am trying to
extract the string "TEST4444" - or whatever name the order might have
- from the following string "Order TEST4444 is not valid."

I am definitely going to have to take the time to learn all about
patterns but for the time being could someone please help me work out
how to do this in VB.NET.

Thank you!

David
Nov 20 '05 #1
4 1862
Dim str As String = "TEST4444"

Dim order As String = str.Substring(4)

MessageBox.Show(order)



"David Brower" <da*********@hotmail.com> wrote in message
news:af**************************@posting.google.c om...
Hi Folks,

I have little knowledge of regular expressions but I am trying to
extract the string "TEST4444" - or whatever name the order might have
- from the following string "Order TEST4444 is not valid."

I am definitely going to have to take the time to learn all about
patterns but for the time being could someone please help me work out
how to do this in VB.NET.

Thank you!

David

Nov 20 '05 #2
You could try this:

(?<=Order )\w+(?= is not valid)

It will pick up the word that is between "Order " and " is not valid". The
word may contain letters, numbers, or the "_" character. If your order name
can contain other characters and/or white space, you may want to try:

(?<=Order ).+?(?= is not valid)
Brian Davis
www.knowdotnet.com
"David Brower" <da*********@hotmail.com> wrote in message
news:af**************************@posting.google.c om...
Hi Folks,

I have little knowledge of regular expressions but I am trying to
extract the string "TEST4444" - or whatever name the order might have
- from the following string "Order TEST4444 is not valid."

I am definitely going to have to take the time to learn all about
patterns but for the time being could someone please help me work out
how to do this in VB.NET.

Thank you!

David

Nov 20 '05 #3
Sorry, I thought you may have wanted just a solution to extract the order
number. If this is inappropriate then please ignore it.

Regards

"One Handed Man [ OHM ]" <te***************************@BTOpenworld.com>
wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
Dim str As String = "TEST4444"

Dim order As String = str.Substring(4)

MessageBox.Show(order)



"David Brower" <da*********@hotmail.com> wrote in message
news:af**************************@posting.google.c om...
Hi Folks,

I have little knowledge of regular expressions but I am trying to
extract the string "TEST4444" - or whatever name the order might have
- from the following string "Order TEST4444 is not valid."

I am definitely going to have to take the time to learn all about
patterns but for the time being could someone please help me work out
how to do this in VB.NET.

Thank you!

David


Nov 20 '05 #4
That's great, Brian. Exactly what I needed.
Thank you both,
David
Nov 20 '05 #5

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

Similar topics

1
4155
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
7
2176
by: Patient Guy | last post by:
Coding patterns for regular expressions is completely unintuitive, as far as I can see. I have been trying to write script that produces an array of attribute components within an HTML element. ...
3
249
by: rdi | last post by:
I get the idea of how to create the search patterns. But what I'm having trouble with is how to actually implement regular expressions. I can't seem to find any code that actually USES them. In...
2
2462
by: cleo | last post by:
I'm experimenting with Regular Expressions and Windows Forms. Frequently I want a value to be either a valid pattern or empty. For example a Zip code must be 5 digits or may be empty. I know that...
3
1425
by: rodchar | last post by:
hey all, what would my expression look like if i wanted to make sure that the input matched the following pattern. c:\filename.ext it doesn't have to be the c drive just a letter, colon,...
4
5141
by: Együd Csaba | last post by:
Hi All, I'd like to "compress" the following two filter expressions into one - assuming that it makes sense regarding query execution performance. .... where (adate LIKE "2004.01.10 __:30" or...
7
3794
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
6
2272
by: Ludwig | last post by:
Hi, i'm using the regular expression \b\w to find the beginning of a word, in my C# application. If the word is 'public', for example, it works. However, if the word is '<public', it does not...
25
5129
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
0
1938
by: peridian | last post by:
Hi, I wanted a web page where I could post code to, and have it appear in coloured formatting based on the context of the code. Most of the techniques I have seen for this involve complex use...
0
7224
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
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7379
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...
1
7038
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
7493
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...
0
5625
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5049
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.