473,503 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How does Regex work?

I tried

Dim s As String = "1 2 3 4 5"

Regex.Replace(s, "3", "6")

but no luck, nothing was changed?
Nov 21 '05 #1
9 1334
<Lucio H> schrieb:
I tried

Dim s As String = "1 2 3 4 5"

Regex.Replace(s, "3", "6")


\\\
s = Regex.Replace(s, "3", "6")
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2
This was driving me crazy, thanks!!!
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OS**************@TK2MSFTNGP14.phx.gbl...
<Lucio H> schrieb:
I tried

Dim s As String = "1 2 3 4 5"

Regex.Replace(s, "3", "6")


\\\
s = Regex.Replace(s, "3", "6")
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
Lucio,

Why not just
Dim s As String = "1 2 3 4 5"

Regex.Replace(s, "3", "6")

s = Replace("3","6") it will not be a big time benefit, however there will
be probably a time benefit and describes in my idea at least better what you
want that the program does.

Just my idea

Cor
Nov 21 '05 #4
Hi Cor, the reason is that I was not really interested in the substitution
per se, I wanted to know how regex works, I am sure you are not
suggesting regex is an unusfull tool...

tnx.
--

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uz**************@TK2MSFTNGP09.phx.gbl...
Lucio,

Why not just
Dim s As String = "1 2 3 4 5"

Regex.Replace(s, "3", "6")

s = Replace("3","6") it will not be a big time benefit, however there will
be probably a time benefit and describes in my idea at least better what
you want that the program does.

Just my idea

Cor

Nov 21 '05 #5
<Lucio H> wrote in news:eA*************@TK2MSFTNGP15.phx.gbl:
Hi Cor, the reason is that I was not really interested in the
substitution per se, I wanted to know how regex works, I am sure you
are not suggesting regex is an unusfull tool...


Ancient PERL proverb...

If you have a problem and require a regex to solve it, you now have two
problems.
All the best

Tim F

Nov 21 '05 #6
Lucio,
Hi Cor, the reason is that I was not really interested in the substitution
per se, I wanted to know how regex works, I am sure you are not
suggesting regex is an unusfull tool...

No in general not, however for the sample from you it is.

It is useful there where the change is complex.

Cor
Nov 21 '05 #7
It seems regular expressions where easier in vi and perl, though
they didn't have unicode to contend with...
regex- i love it !!

"Tim Ferguson" <Fe********@softhome.net> wrote in message
news:Xn*****************************@207.46.248.16 ...
<Lucio H> wrote in news:eA*************@TK2MSFTNGP15.phx.gbl:
Hi Cor, the reason is that I was not really interested in the
substitution per se, I wanted to know how regex works, I am sure you
are not suggesting regex is an unusfull tool...


Ancient PERL proverb...

If you have a problem and require a regex to solve it, you now have two
problems.
All the best

Tim F

Nov 21 '05 #8
Lucio,

I forgot to give you some good links for regex.

RegexLib
http://www.regexlib.com/Default.aspx

Expresso
http://www.ultrapico.com/Expresso.htm
I hope this helps a little bit?

Cor
Nov 21 '05 #9
Thank you Cor, you have read my mind.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uD**************@TK2MSFTNGP14.phx.gbl...
Lucio,

I forgot to give you some good links for regex.

RegexLib
http://www.regexlib.com/Default.aspx

Expresso
http://www.ultrapico.com/Expresso.htm
I hope this helps a little bit?

Cor

Nov 21 '05 #10

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

Similar topics

16
2129
by: Andrew Baker | last post by:
I am trying to write a function which provides my users with a file filter. The filter used to work just using the VB "Like" comparision, but I can't find the equivilant in C#. I looked at...
1
5318
by: Ada | last post by:
i'm trying to use Regex to match a 4 number group pattern. once a match is found, write it to RichTextBox in red. test data: This is my 4567 test data. 1234this is another line of data. Here's...
7
2593
by: bill tie | last post by:
I'd appreciate it if you could advise. 1. How do I replace "\" (backslash) with anything? 2. Suppose I want to replace (a) every occurrence of characters "a", "b", "c", "d" with "x", (b)...
6
1761
by: tshad | last post by:
Is there a way to use Regex inside of a tag, such as asp:label? I tried something like this but can't make it work: <asp:label id="Phone" text=Regex.Replace('<%# Container.DataItem("Phone")...
8
1810
by: vbmark | last post by:
I'm new to RegEx in vb.net so I'm not sure how to do this. I want to know if a string contains two minus signs "-". If there are two then I want it to return TRUE. I also need to know if the...
6
2484
by: Extremest | last post by:
I have a huge regex setup going on. If I don't do each one by itself instead of all in one it won't work for. Also would like to know if there is a faster way tried to use string.replace with all...
7
2565
by: Extremest | last post by:
I am using this regex. static Regex paranthesis = new Regex("(\\d*/\\d*)", RegexOptions.IgnoreCase); it should find everything between parenthesis that have some numbers onyl then a forward...
3
1843
by: Efi | last post by:
Hello, I am trying to capture empty lines, for example : 1. ABCDEF 2. 3. abcdef I would like to capture line number 2. I am using the following regex - new...
1
1152
by: TtfnJohn | last post by:
I have two small scripts that while on the surface should both work the problem is they don't. Here's the first one: import re testString = 'Thap,fpvi,*!wtyd@*.dip.t-dialin.net:*!ylx@*.dip.t-...
0
7334
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
6993
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
7462
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...
1
5014
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
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
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
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1514
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 ...
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.