Skip to content

Commit

Permalink
Merge branch 'Release2.0.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Glyceri committed Jul 27, 2024
2 parents b8ef553 + 93db840 commit 8818c1b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions PetNicknames/PetNicknames/PettableDatabase/PettableNameDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using PN.S;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using static FFXIVClientStructs.FFXIV.Client.Graphics.Kernel.VertexShader;

namespace PetRenamer.PetNicknames.PettableDatabase;

Expand Down Expand Up @@ -124,6 +126,12 @@ void SetDirty()
{
if (name.IsNullOrWhitespace()) return null;

try
{
name = urlRegex.Replace(name, string.Empty);
}
catch { }

if (name.Length > PluginConstants.ffxivNameSize)
{
name = name.Substring(0, PluginConstants.ffxivNameSize);
Expand All @@ -136,4 +144,9 @@ void SetDirty()

return name;
}

readonly Regex urlRegex = new Regex(
@"\b(?:(?:https?|ftp):\/\/)?(?:(?:[a-z0-9\-]+\.)+[a-z]{2,}|localhost)(?::\d{1,5})?(?:\/[^\s]*)?\b",
RegexOptions.Compiled | RegexOptions.IgnoreCase
);
}

0 comments on commit 8818c1b

Please sign in to comment.