export const parsePriceJPY = (text: string | null | undefined): number | null => { if (text == null) return null; const stripped = text .replace(/&[a-z]+;/gi, " ") .replace(/[,,]/g, "") .replace(/pt|ポイント|円|¥|¥/gi, "") .trim(); const match = stripped.match(/-?\d+(?:\.\d+)?/); if (!match) return null; const n = Number(match[0]); if (!Number.isFinite(n)) return null; return Math.trunc(n); };