“Currency” is one of the patterns that you can select on the Match panel. Use this pattern to make a field match a currency code as defined in the ISO 4217 standard. You can restrict the field to specific currencies.
Suppose you have a database of orders for a company that accepts various currencies. The database stores a three-letter ISO currency code for each order. You want to retrieve all orders in euro (and British pounds. from customers based in the European Union. You want to create a regular expression that matches these two currency codes. You can find this example as “Pattern: currency” in the RegexMagic library.
- Click the New Formula button on the top toolbar to clear out all settings on the Samples, Match, and Action panels.
- On the Samples panel, paste in one new sample:
- On the Match panel, select EUR in the sample text and click the Mark button. RegexMagic automatically adds a field using the currency pattern with “EUR Euro” selected in the list of currencies.
- Select GBP in the sample text and click button . RegexMagic automatically selects “GBP Pound sterling” in the list of currencies.
- On the Regex panel, select “C# (.NET 2.0–7.0)” as your application, turn off free-spacing, and turn off mode modifiers. Click the Generate button, and you’ll get this regular expression:
Required options: Case insensitive.
Unused options: Exact spacing; Dot doesn’t match line breaks; ^$ don’t match at line breaks; Numbered capture.
- On the Use panel, select a database such as MySQL, Oracle, or PostgreSQL in the Language drop-down list.
- In the Function drop-down list, choose “select rows in which a column is entirely matched by the regex”.
- Enter the name of table you’re selecting rows from and the name of the column with the currency code to generate a SQL statement for selecting all orders in euro and pounds.