..:: 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         914  0.5  0.5 1306896 83448 ?       Ssl  Aug04 308:42 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa         935  0.7  0.8 11786840 132912 ?     Ssl  Aug04 458:05 node /home/sasa/dex8/dex8-api/starter.js
sasa         938  0.4  0.4 1306780 75844 ?       Ssl  Aug04 259:49 node /home/sasa/regoch/regoch-www/server
sasa         945  0.3  0.4 1303752 71392 ?       Ssl  Aug04 223:17 node /home/sasa/dex8/dex8-panel/server/index.js
sasa         947  0.7  0.6 11826604 104356 ?     Ssl  Aug04 455:42 node /home/sasa/dex8/dex8-www/server/index.js
sasa         966  0.5  0.5 11808976 97792 ?      Ssl  Aug04 343:23 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa         980  0.7  0.5 1330216 82924 ?       Ssl  Aug04 467:31 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js
sasa         997  0.3  0.4 1303104 71752 ?       Ssl  Aug04 225:33 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1021  0.3  0.3 1297920 65304 ?       Ssl  Aug04 222:27 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1065  0.6  0.5 11802464 92372 ?      Ssl  Aug04 378:03 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa        1074  0.6  0.6 1149316 104416 ?      Ssl  Aug04 369:19 node /home/sasa/voovuu/voovuu-api/starter.js
sasa        1136  0.7  0.9 11864484 160128 ?     Ssl  Aug04 430:29 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1148  0.4  0.4 11794644 78436 ?      Ssl  Aug04 246:05 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa        1197  0.3  0.3 1099884 63536 ?       Ssl  Aug04 229:56 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1199  0.3  0.4 22280828 80328 ?      Ssl  Aug04 233:07 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1308  0.3  0.3 1099616 63704 ?       Ssl  Aug04 229:15 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1325  0.3  0.3 1099616 62964 ?       Ssl  Aug04 229:05 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1393  0.7  0.8 22321124 141188 ?     Ssl  Aug04 475:17 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1395  0.3  0.3 1099884 63668 ?       Ssl  Aug04 230:12 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1489  0.3  0.3 1099872 63544 ?       Ssl  Aug04 230:07 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1496  0.3  0.4 1100384 65552 ?       Ssl  Aug04 228:50 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1607  0.3  0.3 1099616 63404 ?       Ssl  Aug04 229:24 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1608  0.3  0.3 1099872 63188 ?       Ssl  Aug04 228:18 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1686  1.1  0.8 11846976 147312 ?     Ssl  Aug04 670:49 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
www-data  592534  0.0  0.0   2608   596 ?        S    10:50   0:00 sh -c ps -aux | grep node
www-data  592536  0.0  0.0   3304   724 ?        S    10:50   0:00 grep node
sasa     1371685  0.4  0.5 11813288 93492 ?      Ssl  Aug16 183:10 node /home/sasa/mikosoft-info/solar-wind-energy/server/index.js
sasa     1460918  0.4  0.3 1300136 65200 ?       Ssl  Aug17 180:50 node /home/sasa/sites-nodejs/oxygen-free-copper/server.js