mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-22 10:51:02 +01:00
- Added RegexReplace class for handling regex replacements. - Created ReleaseGroupParser for extracting release groups from titles. - Developed TitleParser for parsing movie titles, including editions and IDs. - Introduced QualitySource, Resolution, QualityModifier enums and QualityResult class for quality metadata. - Set up Dockerfile and docker-compose for containerized deployment. - Implemented ASP.NET Core web API for parsing requests. - Added TypeScript client for interacting with the parser service. - Enhanced configuration to support dynamic parser service URL.
28 lines
664 B
C#
28 lines
664 B
C#
using System.Text.RegularExpressions;
|
|
|
|
namespace Parser.Core;
|
|
|
|
public class RegexReplace
|
|
{
|
|
private readonly Regex _regex;
|
|
private readonly string _replacementFormat;
|
|
|
|
public RegexReplace(string pattern, string replacement, RegexOptions regexOptions)
|
|
{
|
|
_regex = new Regex(pattern, regexOptions);
|
|
_replacementFormat = replacement;
|
|
}
|
|
|
|
public string Replace(string input)
|
|
{
|
|
return _regex.Replace(input, _replacementFormat);
|
|
}
|
|
|
|
public bool TryReplace(ref string input)
|
|
{
|
|
var result = _regex.IsMatch(input);
|
|
input = _regex.Replace(input, _replacementFormat);
|
|
return result;
|
|
}
|
|
}
|