this will hopefully move u closer a bit:
flavor .NET
match text where non-newline character (Group_1) is
immediately
followed by '011' (Group_2) using pattern:
(?<Group_1>[^n])(?<Group_2>011)
then replace it with inserted newline as
$1n$2
as a result, text :
011fadjf;adkjf;alk011dsjfadlkfjadsklfja;sdkljf011dasl;d;as
would become :
011fadjf;adkjf;alk
011dsjfadlkfjadsklfja;sdkljf
011dasl;d;as
code in c# .net:
using System;
using System.Text.RegularExpressions;
public class Clean_Phone_No
{
public static void Main()
{
//declare an input string of text
string InputString =
"011fadjf;adkjf;alk011dsjfadlkfjadsklfja;sdkljf0
11dasl;d;as";
//declare RegEx object
Regex r = new Regex(
"([^n])(011)",
RegexOptions.IgnoreCase
| RegexOptions.Multiline
| RegexOptions.Compiled );
//clean the input string by replacing with captured group
1
string ResultString = r.Replace(InputString,
"$1n$2");
//print the cleaned string
Console.WriteLine("ResultString: " +
ResultString+ "nPress Enter to
Exit");
Console.ReadLine();
}
}
|