-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindReplace.cs
More file actions
29 lines (27 loc) · 879 Bytes
/
FindReplace.cs
File metadata and controls
29 lines (27 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Text.RegularExpressions;
namespace AutoRegex
{
/// <summary>
/// A Find & Replace object with a defined Match & Replace pattern
/// </summary>
class FindReplace
{
private String MatchPattern { get; }
private String ReplacePattern { get; }
public FindReplace(String matchPattern, String replacePattern)
{
MatchPattern = matchPattern;
ReplacePattern = replacePattern;
}
/// <summary>
/// Execute given string by defined Match & Replace patterns
/// </summary>
/// <param name="strInput">String to be moddified</param>
/// <returns>Returns new moddified String value</returns>
public String Execute(String strInput)
{
return Regex.Replace(strInput, MatchPattern, ReplacePattern);
}
}
}