How does Regex work?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I tried

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

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



but no luck, nothing was changed?
 
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.
 
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 !!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top