Hi

Regular Expression for remove whitespace and url format in c# #regx

 Regular Expression for remove whitespace and url format in c# #regx


using System;

using System.Text.RegularExpressions;


public class Program

{

public static void Main()

{

String d="eded ef erf";

d=Regex.Replace(d, @"\s+", "");

Console.WriteLine(d);

var conteudo = @"........................ -Dfile.jar=C:\JAR.jar -cp .........";

var pattern = @"-Dfile.jar=(.*)\s-cp(.)*";

Regex r = new Regex(pattern, RegexOptions.IgnoreCase);

Match m = r.Match(conteudo);

if (m.Success) 

{

Console.WriteLine(m.Groups[1]);

}

}

}




Previous
Next Post »