Need help in RegEx

  • Thread starter Thread starter JM
  • Start date Start date
J

JM

Hi,

I don't know much about regex and need a help. I have got :

1. Original string: http://www.rediff.com/general/story/9622681/id=123

2. and I want to convert it into
http://www.rediff.com/general/story/print/9622681/id=123

See the "print". This is the only additional directory in #2.

Basically I need a way by which I can apply a RegEx to original string
(i.e. #1) and should get the desired URL as in #2.

And if this can be done in one step that would be great as I need to
create a function which should do this conversion for all these kind of
URLs.

Thanks
JM
 
JM said:
Hi,

I don't know much about regex and need a help. I have got :

1. Original string: http://www.rediff.com/general/story/9622681/id=123

2. and I want to convert it into
http://www.rediff.com/general/story/print/9622681/id=123

See the "print". This is the only additional directory in #2.

Basically I need a way by which I can apply a RegEx to original string
(i.e. #1) and should get the desired URL as in #2.

And if this can be done in one step that would be great as I need to
create a function which should do this conversion for all these kind of
URLs.

What is wrong with:

string newUrl = oldUrl.Replace("/story/", "/story/print/");

?
 

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

Regex in C# 4
Regex help needed 1
Regex help 1
Regex. Digits, Letters and Dashes. what am I doing wrong? 6
Bug in Regex? 5
Need help with RegEx 8
RegEx Help!! 2
regex multiplication problem 3

Back
Top