I tried
Dim s As String = "1 2 3 4 5"
Regex.Replace(s , "3", "6")
but no luck, nothing was changed? 9 1342
<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/>
This was driving me crazy, thanks!!!
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:OS******** ******@TK2MSFTN GP14.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/>
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
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******** ******@TK2MSFTN GP09.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
<Lucio H> wrote in news:eA******** *****@TK2MSFTNG P15.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
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
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********@sof thome.net> wrote in message
news:Xn******** *************** ******@207.46.2 48.16... <Lucio H> wrote in news:eA******** *****@TK2MSFTNG P15.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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 RegEx.IsMatch but
it behaves quite differently. Is there a way I can mimic the DOS
filtering of filenames (eg. "*.*" or "*" returns all files, "*.xls"
returns all excel files, "workbook*" returns all files begining with
"workbook" etc)?
thanks in...
|
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 two more 9876 5432.
What a headache!!!
|
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) every occurrence of characters "p", "q", "r", "s" with "y".
Right now, I do it as follows:
|
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")
%>',"(\d{3})(\d{3})(\d{4})","($1) $2-$3") runat="server"/>
I have this inside my Repeater and want it to filter the field during bind.
I can do it afterwards by just looping through the repeater items, but that
is extra work and time.
|
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 string contains two plus signs "+". Should this
be a seperate RegEx or can one RegEx check for both signs?
Thanks!
| |
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 the right
parts in there in one big line and for some reason that did not work
either. Here is my regex's.
static Regex rar = new Regex("\\.part.*",
RegexOptions.IgnoreCase);
static Regex par = new Regex("\\.vol.*",
RegexOptions.IgnoreCase);
|
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 slash then some numbers. For some reason I am not
getting that. It won't work at all in 2.0
|
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
Regex("^$",RegexOptions.Multiline);
|
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-
dialin.net:*!lajaz@*.dip.t-dialin.net::::::'
reobj = re.compile(r"(.*),(.*),(.*):::(.*):::(.*)")
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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 we have to send another system
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |