mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 13:12:39 +01:00
Merge pull request #1597 from ivandrofly/sf-patch2
Consistent with regex-time-code naming convention
This commit is contained in:
commit
39e6ceda24
@ -11,7 +11,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
/// </summary>
|
||||
public class Lrc : SubtitleFormat
|
||||
{
|
||||
private static Regex _timeCode = new Regex(@"^\[\d+:\d\d\.\d\d\].*$", RegexOptions.Compiled);
|
||||
private static readonly Regex RegexTimeCodes = new Regex(@"^\[\d+:\d\d\.\d\d\].*$", RegexOptions.Compiled);
|
||||
|
||||
public override string Extension
|
||||
{
|
||||
@ -88,7 +88,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
char[] splitChars = { ':', '.' };
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (line.StartsWith('[') && _timeCode.Match(line).Success)
|
||||
if (line.StartsWith('[') && RegexTimeCodes.Match(line).Success)
|
||||
{
|
||||
string s = line;
|
||||
s = line.Substring(1, 8);
|
||||
@ -162,7 +162,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
for (int i = 0; i < max; i++)
|
||||
{
|
||||
Paragraph p = subtitle.Paragraphs[i];
|
||||
while (_timeCode.Match(p.Text).Success)
|
||||
while (RegexTimeCodes.Match(p.Text).Success)
|
||||
{
|
||||
string s = p.Text.Substring(1, 8);
|
||||
p.Text = p.Text.Remove(0, 10).Trim();
|
||||
@ -220,7 +220,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
|
||||
private static string GetTextAfterTimeCodes(string s)
|
||||
{
|
||||
while (_timeCode.IsMatch(s))
|
||||
while (RegexTimeCodes.IsMatch(s))
|
||||
s = s.Remove(0, 10).Trim();
|
||||
return s;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
{
|
||||
public class TMPlayer : SubtitleFormat
|
||||
{
|
||||
private static readonly Regex regex = new Regex(@"^\d+:\d\d:\d\d[: ].*$", RegexOptions.Compiled); // accept a " " instead of the last ":" too
|
||||
private static readonly Regex RegexTimeCodes = new Regex(@"^\d+:\d\d:\d\d[: ].*$", RegexOptions.Compiled); // accept a " " instead of the last ":" too
|
||||
|
||||
public override string Extension
|
||||
{
|
||||
@ -74,7 +74,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
foreach (string line in lines)
|
||||
{
|
||||
bool success = false;
|
||||
if (line.IndexOf(':') > 0 && regex.Match(line).Success)
|
||||
if (line.IndexOf(':') > 0 && RegexTimeCodes.Match(line).Success)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -7,7 +7,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
{
|
||||
public class TurboTitler : SubtitleFormat
|
||||
{
|
||||
private static readonly Regex regexTimeCodes = new Regex(@"^\d:\d\d:\d\d\.\d\d,\d:\d\d:\d\d\.\d\d,NTP ", RegexOptions.Compiled);
|
||||
private static readonly Regex RegexTimeCodes = new Regex(@"^\d:\d\d:\d\d\.\d\d,\d:\d\d:\d\d\.\d\d,NTP ", RegexOptions.Compiled);
|
||||
|
||||
public override string Extension
|
||||
{
|
||||
@ -57,7 +57,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
char[] splitChars = { ':', '.' };
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (regexTimeCodes.IsMatch(line))
|
||||
if (RegexTimeCodes.IsMatch(line))
|
||||
{
|
||||
string[] parts = line.Substring(0, 10).Trim().Split(splitChars, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (parts.Length == 4)
|
||||
|
Loading…
Reference in New Issue
Block a user