Skip to content

Instantly share code, notes, and snippets.

View chenten16's full-sized avatar
🏠
Working from home

Mohammed Filali chenten16

🏠
Working from home
View GitHub Profile
@chenten16
chenten16 / currencyExtractor.js
Created May 5, 2023 01:07
A js function to extract currency symbols and amounts from a given input string
export const extractCurrencyAndPrice = fullPrice => {
// Regular expression to match currency symbol and amount
const regex = /((?:\p{Sc}|[a-zA-Z]{1,3})\s*)?([\d,.]+)(?:\s*((?:\p{Sc}|[a-zA-Z]{1,3})))?/gu;
const matches = regex.exec(fullPrice);
if (!matches) {
throw new Error('Invalid input format [input: ' + fullPrice + ']');
}
[{
"_id": {
"$oid": "61805d24131b8baeb84153d3"
},
"api_key": "08f23b2a06ef472d88bf9246d6c4a0a9d1ade7a0e2364defbfa987ee9b00c2eb",
"api_secret": "3f8d0caf5e280348c92de152977144124c21ec250497995151da9434c575373899bda6aca68eb94fe0e22d409ece5ec4133c9dc6398b366bb30e2eaa4beb0c5588ddc4ad51960f5621f8b36305484df1d83a2fa47cd687e05ff4f51d70ba850c518750b7",
"__v": 0
}]
[{
"_id": {
"$oid": "617e374718da4f516962a8b3"
},
"botName": "test_lunarcrush",
"numberCoin": 20,
"category": "all",
"filters": [
{
"altrank": true,
[
{
"word":"monkaS",
"url":"https://cdn.betterttv.net/emote/56e9f494fff3cc5c35e5287e/1x"
},
{
"word":"OMEGALUL",
"url":"https://cdn.betterttv.net/emote/583089f4737a8e61abb0186b/1x"
},
{