..:: Source code - 035stringmethods_replace.js ::..

/**
 * String methods: replace
 * The replace() method returns a new string with some or all matches of a 
 * pattern replaced by a replacement.
 */
var str, x, xg, xi;

str = "simple example of simple string BIG big";

x = str.replace('simple', 'not simple'); //replace first match
xg = str.replace(/s\w+e/g, 'not simple'); //replace all matches
xi = str.replace(/BiG/i, 'SmaLL'); //case insensitive replacement


console.log(x); // not simple example of simple string BIG big
console.log(xg); // not simple example of not simple string BIG big
console.log(xi); // simple example of simple string SmaLL big
 

..:: NodeJS Console - 035stringmethods_replace.js ::..

$ node 035stringmethods_replace.js
not simple example of simple string BIG big
not simple example of not simple string BIG big
simple example of simple string SmaLL big
$ps -aux | grep node (list all node processes)
sasa        1194  0.4  0.5 1305608 86164 ?       Ssl   2025 1401:55 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa        1208  0.3  0.4 1304488 72580 ?       Ssl   2025 996:27 node /home/sasa/dex8/dex8-panel/server/index.js
sasa        1236  0.5  0.6 11819984 107364 ?     Ssl   2025 1574:56 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa        1257  0.3  0.4 1304920 72884 ?       Ssl   2025 1010:36 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1289  0.3  0.4 1298028 68156 ?       Ssl   2025 995:09 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1363  4.5  2.7 12148604 443088 ?     Ssl   2025 13002:44 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1886  4.4  3.0 12167828 505728 ?     Ssl   2025 12585:40 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
sasa     1214480  0.3  0.7 22311168 125456 ?     Ssl   2025 733:58 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214483  0.3  0.3 1101568 65272 ?       Ssl   2025 650:12 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214536  0.3  0.4 1102084 66648 ?       Ssl   2025 648:49 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214544  0.3  0.4 1101032 66268 ?       Ssl   2025 653:33 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214588  0.3  0.3 1100292 63948 ?       Ssl   2025 650:17 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214617  0.3  0.4 1103232 68368 ?       Ssl   2025 648:27 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214641  0.3  0.3 1100904 64352 ?       Ssl   2025 638:55 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214671  0.3  0.3 1101408 64656 ?       Ssl   2025 636:37 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1215731  0.7  0.7 11715676 128944 ?     Ssl   2025 1426:03 node /home/sasa/dex8/dex8-api/starter.js
sasa     1216489  0.3  0.3 1100280 64660 ?       Ssl   2025 647:52 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1399960  0.8  0.7 11822368 117976 ?     Ssl  Apr20 245:18 node /home/sasa/dex8/dex8-www/server/index.js
sasa     1904154  0.6  0.6 11832656 111300 ?     Ssl  Apr25 137:53 node /home/sasa/miko/miko-hr/server/index.js
sasa     2628167  0.8  0.8 1182808 131120 ?      Ssl   2025 2268:09 node /home/sasa/voovuu/voovuu-api/starter.js
sasa     3168557  0.6  0.5 11804572 92644 ?      Ssl   2025 1651:08 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa     3169051  0.5  0.5 11799176 84524 ?      Ssl   2025 1367:14 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa     3264954  0.7  0.5 1332492 86468 ?       Ssl  Feb21 791:12 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js
sasa     3535954  0.3  0.3 1099104 63688 ?       Ssl  04:03   2:47 node /home/sasa/dex8/dex8-worker/starter.js
www-data 3600361  0.0  0.0   2608   596 ?        S    18:26   0:00 sh -c ps -aux | grep node
www-data 3600363  0.0  0.0   3304   708 ?        S    18:26   0:00 grep node