Click here to Skip to main content
15,890,825 members
Home / Discussions / C#
   

C#

 
AnswerRe: Regular Expression to convert from PHP to C# Pin
User 665825-Jun-06 7:26
User 665825-Jun-06 7:26 
GeneralRe: Regular Expression to convert from PHP to C# Pin
AngryC25-Jun-06 7:43
AngryC25-Jun-06 7:43 
GeneralRe: Regular Expression to convert from PHP to C# Pin
Kevin McFarlane25-Jun-06 9:09
Kevin McFarlane25-Jun-06 9:09 
AnswerRe: Regular Expression to convert from PHP to C# [modified] Pin
Graham Nimbley25-Jun-06 9:28
Graham Nimbley25-Jun-06 9:28 
GeneralRe: Regular Expression to convert from PHP to C# Pin
AngryC25-Jun-06 11:02
AngryC25-Jun-06 11:02 
GeneralRe: Regular Expression to convert from PHP to C# [modified] Pin
User 665825-Jun-06 11:52
User 665825-Jun-06 11:52 
GeneralRe: Regular Expression to convert from PHP to C# Pin
AngryC25-Jun-06 12:23
AngryC25-Jun-06 12:23 
GeneralRe: Regular Expression to convert from PHP to C# Pin
Graham Nimbley25-Jun-06 13:36
Graham Nimbley25-Jun-06 13:36 
This should be it.

string regex=@"(.+)\#(.+)\r\n";
string replace=String.Format("{0}$1{1}$2{2}\r\n","Left","Center","Right");

string output=Regex.Replace(input,regex,replace);


I've tweaked the regex as I was having problem with it.

I've dumped the code I used to test it:

using System;
using System.Text.RegularExpressions;

public class Testy
{
	public static void Main()
	{
	
string input="bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla.\r\n\r\n"+
"toto toto toto # toto toto toto\r\n"+
"toto toto toto # toto toto toto\r\n"+
"toto toto toto # toto toto toto\r\n"+
"toto toto toto # toto toto toto\r\n\r\n"+
"bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla";

		string regex=@"(.+)\#(.+)\r\n";
		string replace=String.Format("{0}$1{1}$2{2}\r\n","Left","Center","Right");

		string output=Regex.Replace(input,regex,replace);
		
		Console.WriteLine(output);
	}
}

GeneralRe: Regular Expression to convert from PHP to C# Pin
AngryC25-Jun-06 15:05
AngryC25-Jun-06 15:05 
GeneralRe: Regular Expression to convert from PHP to C# Pin
Graham Nimbley25-Jun-06 15:10
Graham Nimbley25-Jun-06 15:10 
GeneralRe: Regular Expression to convert from PHP to C# Pin
AngryC25-Jun-06 16:51
AngryC25-Jun-06 16:51 
GeneralRe: Regular Expression to convert from PHP to C# [modified] Pin
Graham Nimbley26-Jun-06 8:39
Graham Nimbley26-Jun-06 8:39 
GeneralRe: Regular Expression to convert from PHP to C# [modified] Pin
AngryC26-Jun-06 11:29
AngryC26-Jun-06 11:29 
GeneralRe: Regular Expression to convert from PHP to C# [modified] Pin
Graham Nimbley26-Jun-06 11:56
Graham Nimbley26-Jun-06 11:56 
GeneralRe: Regular Expression to convert from PHP to C# Pin
AngryC26-Jun-06 12:34
AngryC26-Jun-06 12:34 
GeneralRe: Regular Expression to convert from PHP to C# [modified] Pin
Graham Nimbley26-Jun-06 13:05
Graham Nimbley26-Jun-06 13:05 
GeneralRe: Regular Expression to convert from PHP to C# [modified] Pin
AngryC26-Jun-06 13:16
AngryC26-Jun-06 13:16 
GeneralRe: Regular Expression to convert from PHP to C# Pin
Graham Nimbley26-Jun-06 13:21
Graham Nimbley26-Jun-06 13:21 
GeneralRe: Regular Expression to convert from PHP to C# Pin
AngryC26-Jun-06 13:30
AngryC26-Jun-06 13:30 
GeneralRe: Regular Expression to convert from PHP to C# Pin
Graham Nimbley26-Jun-06 13:41
Graham Nimbley26-Jun-06 13:41 
QuestionDeserialize XML by reverse-engineering class def Pin
Ed 5425-Jun-06 5:18
Ed 5425-Jun-06 5:18 
AnswerRe: Deserialize XML by reverse-engineering class def Pin
Guffa25-Jun-06 6:35
Guffa25-Jun-06 6:35 
GeneralRe: Deserialize XML by reverse-engineering class def Pin
Ed 5425-Jun-06 16:48
Ed 5425-Jun-06 16:48 
AnswerRe: Deserialize XML by reverse-engineering class def Pin
Guffa25-Jun-06 18:52
Guffa25-Jun-06 18:52 
GeneralRe: Deserialize XML by reverse-engineering class def Pin
Ed 5426-Jun-06 12:57
Ed 5426-Jun-06 12:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.