..:: 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  2.4  0.6 1328428 104632 ?      Rsl  Oct18  47:29 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa        1211 15.5  0.8 11737856 141748 ?     Rsl  Oct18 300:11 node /home/sasa/dex8/dex8-api/starter.js
sasa        1218  0.4  0.5 11797904 82624 ?      Ssl  Oct18   7:45 node /home/sasa/dex8/dex8-panel/server/index.js
sasa        1219  0.6  0.5 11801060 88736 ?      Ssl  Oct18  13:12 node /home/sasa/dex8/dex8-www/server/index.js
sasa        1232  0.3  0.5 11797788 82544 ?      Ssl  Oct18   6:56 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa        1248  0.5  0.4 1326500 79672 ?       Ssl  Oct18  10:57 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js
sasa        1274  0.3  0.4 1298284 65872 ?       Ssl  Oct18   6:06 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1277  0.3  0.3 1297128 64092 ?       Ssl  Oct18   5:59 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1335  0.4  0.6 11830272 103904 ?     Ssl  Oct18   7:52 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa        1337  0.6  0.6 1153304 107912 ?      Ssl  Oct18  13:06 node /home/sasa/voovuu/voovuu-api/starter.js
sasa        1385  3.3  2.8 12154800 461780 ?     Ssl  Oct18  63:53 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1387  0.3  0.4 11796032 79984 ?      Ssl  Oct18   6:21 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa        1457  0.3  0.3 1099616 64304 ?       Ssl  Oct18   6:09 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1458  0.3  0.3 1099624 64308 ?       Ssl  Oct18   6:07 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1514  0.3  0.3 1099748 63676 ?       Ssl  Oct18   6:07 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1515  0.3  0.3 1099364 63416 ?       Ssl  Oct18   6:07 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1593  0.3  0.3 1099616 64036 ?       Ssl  Oct18   6:08 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1595  0.3  0.3 1099360 63408 ?       Ssl  Oct18   6:08 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1660  0.3  0.3 1099504 63380 ?       Ssl  Oct18   6:07 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1661  0.3  0.3 1099360 63740 ?       Ssl  Oct18   6:06 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1732  0.3  0.3 1099360 63612 ?       Ssl  Oct18   6:07 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1734  0.3  0.3 1099104 62996 ?       Ssl  Oct18   6:07 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1792  0.4  0.5 11741988 88964 ?      Ssl  Oct18   7:47 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
www-data  165730  0.0  0.0   2608   600 ?        S    21:31   0:00 sh -c ps -aux | grep node
www-data  165732  0.0  0.0   3304   716 ?        S    21:31   0:00 grep node