..:: Source code - 035stringmethods_match.js ::..

/**
 * Sting methods: match
 * i flag means case insensitive matching
 * g flag means global (all occurencies, not only the first)
 */
var str, x, xi, xg, xig;

str = "SOME simple Sample string";

x = str.match(/s\wm/); //case sensitive
xi = str.match(/s\wm/i); //case insensitive
xg = str.match(/s\wm/g); //global
xig = str.match(/s\wm/ig); //ignored and global


console.log(x); // [ 'sim', index: 5, input: 'SOME simple Sample string' ]
console.log(xi); // [ 'SOM', index: 0, input: 'SOME simple Sample string' ]
console.log(xg); // [ 'sim' ]
console.log(xig); // [ 'SOM', 'sim', 'Sam' ]
 

..:: NodeJS Console - 035stringmethods_match.js ::..

$ node 035stringmethods_match.js
[
  'sim',
  index: 5,
  input: 'SOME simple Sample string',
  groups: undefined
]
[
  'SOM',
  index: 0,
  input: 'SOME simple Sample string',
  groups: undefined
]
[ 'sim' ]
[ 'SOM', 'sim', 'Sam' ]
$ps -aux | grep node (list all node processes)
sasa        1197  1.0  0.3 1327628 56408 ?       Ssl  Oct18 461:11 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa        1211  5.9  0.4 11845888 78280 ?      Ssl  Oct18 2541:55 node /home/sasa/dex8/dex8-api/starter.js
sasa        1218  0.4  0.2 11795632 40284 ?      Ssl  Oct18 192:40 node /home/sasa/dex8/dex8-panel/server/index.js
sasa        1219  0.7  0.4 11818392 73384 ?      Ssl  Oct18 323:56 node /home/sasa/dex8/dex8-www/server/index.js
sasa        1248  0.6  0.3 1332144 54520 ?       Ssl  Oct18 277:02 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js
sasa        1274  0.3  0.2 1308772 39232 ?       Ssl  Oct18 135:11 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1337  0.7  0.5 1169288 83264 ?       Ssl  Oct18 306:42 node /home/sasa/voovuu/voovuu-api/starter.js
sasa        1385  4.3  3.5 12371184 583416 ?     Ssl  Oct18 1848:55 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1387  0.3  0.2 11798204 47680 ?      Ssl  Oct18 153:53 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa        1457  0.3  0.2 1302848 37232 ?       Ssl  Oct18 137:17 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1458  0.3  0.2 22281388 41620 ?      Ssl  Oct18 139:13 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1514  0.3  0.1 1231844 29520 ?       Ssl  Oct18 135:39 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1515  0.3  0.1 1166180 29580 ?       Ssl  Oct18 135:20 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1593  0.3  0.1 1165796 28948 ?       Ssl  Oct18 136:00 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1595  0.3  0.1 1166176 28332 ?       Ssl  Oct18 135:40 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1660  0.3  0.1 1165296 27356 ?       Ssl  Oct18 135:24 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1661  0.3  0.1 1165664 28368 ?       Ssl  Oct18 135:29 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1732  0.3  0.1 1099360 27204 ?       Ssl  Oct18 135:15 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1734  0.3  0.1 1099616 27232 ?       Ssl  Oct18 134:51 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1792  3.7  2.9 12350484 487372 ?     Ssl  Oct18 1599:58 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
sasa      367471  1.0  0.3 11855064 64660 ?      Ssl  Oct21 389:14 node /home/sasa/miko/miko-hr/server/index.js
sasa     2446447  0.5  0.5 11851936 82656 ?      Ssl  Nov09  56:26 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa     2511306  0.5  0.2 1330124 44816 ?       Ssl  Nov10  53:04 node /home/sasa/miko/miko-hr/api/starter.js
sasa     3034860  0.4  0.3 11800280 59868 ?      Ssl  Nov13  24:37 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa     3040759  0.3  0.2 1296420 38048 ?       Ssl  Nov13  18:28 node /home/sasa/dex8/dex8-kiosk/server/index.js
root     3404628  0.0  0.0   9492  2228 ?        Ss   Nov13   0:00 bash -c  which psql mongosh mongo 2>/dev/null echo "=== PG test ===" PGPASSWORD="w583Cr#ZED" psql -h 127.0.0.1 -p 6543 -U kriptus_user -d kriptus_dev -tAc "SELECT 1" 2>&1 | head -5 echo "=== MONGO test (node) ===" cd /home/sasa/kriptus/kriptus-api 2>/dev/null && node -e " const {MongoClient}=require(\"mongodb\"); (async()=>{ try{ const c=new MongoClient(\"mongodb://kript:12345@127.0.0.1:27017/kriptus-dev\",{serverSelectionTimeoutMS:5000}); await c.connect(); const d=await c.db().admin().listDatabases(); console.log(\"DBS:\", d.databases.map(x=>x.name).join(\",\")); await c.close(); }catch(e){ console.log(\"ERR\", e.message); } })(); " 2>&1 | head -5 
root     3404790  0.0  0.2 1120356 40876 ?       Sl   Nov13   0:45 node -e  const {MongoClient}=require("mongodb"); (async()=>{ try{ const c=new MongoClient("mongodb://kript:12345@127.0.0.1:27017/kriptus-dev",{serverSelectionTimeoutMS:5000}); await c.connect(); const d=await c.db().admin().listDatabases(); console.log("DBS:", d.databases.map(x=>x.name).join(",")); await c.close(); }catch(e){ console.log("ERR", e.message); } })(); 
www-data 3922776  0.0  0.0   2608   520 ?        S    23:50   0:00 sh -c ps -aux | grep node
www-data 3922778  0.0  0.0   3304   696 ?        S    23:50   0:00 grep node