List Info

Thread: Reg Expression for Replace




Reg Expression for Replace
user name
2006-10-15 23:37:22
I am very very new to Regular Expression.
I am trying to find a regular Exression for replacing a
string eclosed
in "special characters" for e.g. string foo =
"Replace this $string$
with another"

is there an expression I can use that will replace the
string enclosed
between $$ with something else.
Any pointers will be helpful.

Thank you,
Abhi


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://grou
ps-beta.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

Reg Expression for Replace
user name
2006-10-16 11:10:41
Hi Abhi,

You can use this to find and capture a string between dollar signs:

$([^$]+)$

The replace will vary depending on the language you are using. What language are you using? Thanks.

Rick Quatro


On 10/15/06, Abhi < abhijeetsgmail.com">abhijeetsgmail.com> wrote:

I am very very new to Regular Expression.
I am trying to find a regular Exression for replacing a string eclosed
in "special characters" for e.g. string foo = "Replace this $string$
with another&quot;

is there an expression I can use that will replace the string enclosed
between $$ with something else.
Any pointers will be helpful.

Thank you,
Abhi



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

Reg Expression for Replace
user name
2006-10-16 19:41:35
CSharp


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://grou
ps-beta.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

Reg Expression for Replace
user name
2006-10-16 23:57:16
I am not sure how to do replacements in C#. I am sorry about that.

Rick

On 10/16/06, Abhi < abhijeetsgmail.com">abhijeetsgmail.com > wrote:

CSharp



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

Reg Expression for Replace
user name
2006-10-17 15:43:57
Rick, Abhi,

Here is an example of how to use this regex in C# (CSharp):

using System;
using System.Text.RegularExpressions;

namespace RegexTestCS
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
			string foo = "Replace this $string$ with
another";
			string bar = "monkey";
			string pattern = "$([^$]+)$";
			Regex regex = new Regex(pattern);
			Console.Write(regex.Replace(foo, bar));
			Console.ReadLine();
		}
	}
}

On Oct 16, 5:57 pm, "Rick Quatro"
<frameexp...gmail.com> wrote:
> I am not sure how to do replacements in C#. I am sorry
about that.
>
> Rick
>
> On 10/16/06, Abhi <abhije...gmail.com> wrote:
>
>
> 
> > CSharp--
> Rick Quatro
> 585-659-8267http://www.frameexpert.com



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://grou
ps-beta.google.com/group/regex
-~----------~----~----~----~------~----~------~--~---

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )