Currency Regex

Currency Regex is a collection of regular expressions for validating currency formats. It includes the following currencies:

Usage

  1. You can import in your js file es6 (modules,vue,react,...)
import { RX_CURRENCY_EUR } from "helping-js/core/currencies-regex"; // Check URL

const value = "1.000,00€";
if (RX_CURRENCY_EUR.test(value)) {
  console.log("Valid Currency");
} else {
  console.log("Invalid Currency");
}
  1. You can import in your js file es5 (nodejs)
const { RX_CURRENCY_EUR } = require("helping-js/core/currencies-regex"); // Check URL

const value = "1.000,00€";
if (RX_CURRENCY_EUR.test(value)) {
    console.log("Valid Currency");
} else {
    console.log("Invalid Currency");
}
  1. You can usage from CDN (only modules)
import { RX_CURRENCY_EUR } from "https://unpkg.com/browse/helping-js/core/currencies-regex.js";

const value = "+98123456789";
if (RX_CURRENCY_EUR.test(value)) {
  console.log("Valid Currency");
} else {
    console.log("Invalid Currency");
}

Currencies

TitleConstRegexSampleDescription
USDRX_CURRENCY_USD/^$?\d{1,3}(,\d{3})*(.\d{2})?$/$1,000.00US Dollar
EURRX_CURRENCY_EUR/^\d{1,3}(.\d{3})*(,\d{2})?€$/1.000,00€Euro
GBPRX_CURRENCY_GBP/^\d{1,3}(,\d{3})*(.\d{2})?£$/1,000.00£British Pound
JPYRX_CURRENCY_JPY/^¥\d{1,3}(,\d{3})*$/¥1,000Japanese Yen
CNYRX_CURRENCY_CNY/^¥\d{1,3}(,\d{3})*(.\d{2})?$/¥1,000.00Chinese Yuan
KRWRX_CURRENCY_KRW/^₩\d{1,3}(,\d{3})*(.\d{2})?$/₩1,000.00South Korean Won
INRRX_CURRENCY_INR/^₹\d{1,3}(,\d{3})*(.\d{2})?$/₹1,000.00Indian Rupee
RUBRX_CURRENCY_RUB/^\d{1,3}(,\d{3})*(.\d{2})?₽$/1,000.00₽Russian Ruble
BRLRX_CURRENCY_BRL/^R$\d{1,3}(.\d{3})*(,\d{2})?$/R$1.000,00Brazilian Real
AUDRX_CURRENCY_AUD/^$\d{1,3}(,\d{3})*(.\d{2})?$/$1,000.00Australian Dollar
CADRX_CURRENCY_CAD/^$\d{1,3}(,\d{3})*(.\d{2})?$/$1,000.00Canadian Dollar
CHFRX_CURRENCY_CHF/^CHF\d{1,3}(,\d{3})*(.\d{2})?$/CHF1,000.00Swiss Franc
SEKRX_CURRENCY_SEK/^kr\d{1,3}(,\d{3})*(.\d{2})?$/kr1.000,00Swedish Krona
NOKRX_CURRENCY_NOK/^kr\d{1,3}(,\d{3})*(.\d{2})?$/kr1.000,00Norwegian Krone
DKKRX_CURRENCY_DKK/^kr\d{1,3}(,\d{3})*(.\d{2})?$/kr1.000,00Danish Krone
HKDRX_CURRENCY_HKD/^HK$\d{1,3}(,\d{3})*(.\d{2})?$/HK$1,000.00Hong Kong Dollar
TWDRX_CURRENCY_TWD/^NT$\d{1,3}(,\d{3})*(.\d{2})?$/NT$1,000.00New Taiwan Dollar
SGDRX_CURRENCY_SGD/^S$\d{1,3}(,\d{3})*(.\d{2})?$/S$1,000.00Singapore Dollar
MYRRX_CURRENCY_MYR/^RM\d{1,3}(,\d{3})*(.\d{2})?$/RM1,000.00Malaysian Ringgit
PHPRX_CURRENCY_PHP/^₱\d{1,3}(,\d{3})*(.\d{2})?$/₱1,000.00Philippine Peso
IDRRX_CURRENCY_IDR/^Rp\d{1,3}(,\d{3})*(.\d{2})?$/Rp1.000,00Indonesian Rupiah
VNDRX_CURRENCY_VND/^₫\d{1,3}(,\d{3})*(.\d{2})?$/₫1.000,00Vietnamese Dong
THBRX_CURRENCY_THB/^฿\d{1,3}(,\d{3})*(.\d{2})?$/฿1,000.00Thai Baht
TRYRX_CURRENCY_TRY/^₺\d{1,3}(,\d{3})*(.\d{2})?$/₺1.000,00Turkish Lira
ZARRX_CURRENCY_ZAR/^R\d{1,3}(,\d{3})*(.\d{2})?$/R1.000,00South African Rand
NZDRX_CURRENCY_NZD/^NZ$\d{1,3}(,\d{3})*(.\d{2})?$/NZ$1,000.00New Zealand Dollar
ILSRX_CURRENCY_ILS/^₪\d{1,3}(,\d{3})*(.\d{2})?$/₪1,000.00Israeli Shekel
EGPRX_CURRENCY_EGP/^E£\d{1,3}(,\d{3})*(.\d{2})?$/E£1,000.00Egyptian Pound
KWDRX_CURRENCY_KWD/^KD\d{1,3}(,\d{3})*(.\d{2})?$/KD1,000.00Kuwaiti Dinar
AEDRX_CURRENCY_AED/^د.إ\d{1,3}(,\d{3})*(.\d{2})?$/د.إ1,000.00United Arab Emirates Dirham
SARRX_CURRENCY_SAR/^SR\d{1,3}(,\d{3})*(.\d{2})?$/SR1,000.00Saudi Riyal
CZKRX_CURRENCY_CZK/^Kč\d{1,3}(,\d{3})*(.\d{2})?$/Kč1.000,00Czech Koruna
PLNRX_CURRENCY_PLN/^zł\d{1,3}(,\d{3})*(.\d{2})?$/zł1.000,00Polish Zloty
HUFRX_CURRENCY_HUF/^Ft\d{1,3}(,\d{3})*(.\d{2})?$/Ft1.000,00Hungarian Forint
RONRX_CURRENCY_RON/^lei\d{1,3}(,\d{3})*(.\d{2})?$/lei1.000,00Romanian Leu
BGNRX_CURRENCY_BGN/^лв\d{1,3}(,\d{3})*(.\d{2})?$/лв1.000,00Bulgarian Lev
HRKRX_CURRENCY_HRK/^kn\d{1,3}(,\d{3})*(.\d{2})?$/kn1.000,00Croatian Kuna
ISKRX_CURRENCY_ISK/^kr\d{1,3}(,\d{3})*(.\d{2})?$/kr1.000,00Icelandic Krona
Last Updated:
Contributors: parsajiravand