Last active
May 19, 2023 13:23
-
-
Save Git-I985/ceff2ba0685efbc9d815024782cd6f61 to your computer and use it in GitHub Desktop.
Dollar Prices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| from: [ | |
| "$7 000", | |
| "$7000", | |
| "$70.002", | |
| "7000 $", | |
| "7% test, test to $7 000", | |
| "7% test, test to $7000", | |
| "7% test, test to 7000$", | |
| "7% test, test to 7000 $", | |
| "7000 $ test, 7000 $ test to $ 7 000" | |
| ] | |
| to: [ | |
| "<span>$7 000</span>", | |
| "<span>$7000</span>", | |
| "<span>$70.002</span>", | |
| "<span>7000 $</span>", | |
| "7% test, test to <span>$7 000</span>", | |
| "7% test, test to <span>$7000</span>", | |
| "7% test, test to <span>7000$</span>", | |
| "7% test, test to <span>7000 $</span>", | |
| "<span>7000 $</span> test, 7000 $ up to <span>$ 7 000</span>" | |
| ] | |
| */ | |
| const wrapPrices = (str: string): string => | |
| str | |
| .replaceAll(/(\d(\d| |\.)+\$)/gm, `<span>$&</span>`) | |
| .replaceAll(/\$ ?(\d(\d| |\.)+)/gm, `<span>$&</span>`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment