Skip to content

Commit

Permalink
Merge pull request #651 from LukasJK/patch-1
Browse files Browse the repository at this point in the history
Expand Remark Regexes
  • Loading branch information
daniluk4000 authored Jan 19, 2025
2 parents 897c705 + 4201b7b commit 251b5be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function isNumber(val: unknown, allowedAfterDot = 0): val is number {
}

export function getVACallsign(remarks: string): { callsign: string; name: string | null } | null {
const exec = /(CS\/|CALLSIGN(\/| ))(?<callsign>[A-Z ]+)(((\/(?<name>[A-Z ]+)(?= ([ A-Z]+)?\/[A-Z]))|((?= [A-Z]+\/[A-Z]))|(?=$))|((?= ([ A-Z]+)?\/[A-Z]))|((?= [A-Z]+\/[A-Z]))|(?=$))/.exec(remarks);
const exec = /(CS[\/-]|CALLSIGN([\/-]| ))(?<callsign>[A-Z ]+)((([\/-](?<name>[A-Z ]+)(?= ([ A-Z]+)?[\/-][A-Z]))|((?= [A-Z]+[\/-][A-Z]))|(?=$))|((?= ([ A-Z]+)?[\/-][A-Z]))|((?= [A-Z]+[\/-][A-Z]))|(?=$))/.exec(remarks);
if (exec?.groups?.callsign) {
return {
callsign: exec.groups.callsign?.replace('VATSIMVA', '').trim(),
Expand All @@ -95,7 +95,7 @@ export function getVACallsign(remarks: string): { callsign: string; name: string
}

export function getVAWebsite(remarks: string) {
const website = /WEB\/(?<website>.+?)(?= )/.exec(remarks)?.groups?.website?.toLowerCase() ?? null;
const website = /WEB[\/-](?<website>.+?)(?= )/.exec(remarks)?.groups?.website?.toLowerCase() ?? null;

if (!website) return website;

Expand Down

0 comments on commit 251b5be

Please sign in to comment.