..:: 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 1306008 85164 ?       Ssl   2025 1420:26 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa        1208  0.3  0.4 1306536 71980 ?       Ssl   2025 1009:58 node /home/sasa/dex8/dex8-panel/server/index.js
sasa        1236  0.5  0.6 11819816 109076 ?     Ssl   2025 1596:01 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa        1257  0.3  0.4 1305176 73468 ?       Ssl   2025 1024:15 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1289  0.3  0.4 1298220 68516 ?       Ssl   2025 1008:37 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1363  4.5  3.1 12197188 508520 ?     Ssl   2025 13182:51 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1886  4.5  3.3 12203636 545948 ?     Ssl   2025 13058:32 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
sasa     1214480  0.3  0.7 22311168 125708 ?     Ssl   2025 749:00 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214483  0.3  0.4 1101312 65624 ?       Ssl   2025 664:34 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214536  0.3  0.4 1103364 67924 ?       Ssl   2025 663:07 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214544  0.3  0.4 1101800 66124 ?       Ssl   2025 668:02 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214588  0.3  0.3 1100804 64832 ?       Ssl   2025 664:40 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214617  0.3  0.3 1100672 65192 ?       Ssl   2025 662:44 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214641  0.3  0.3 1100648 64428 ?       Ssl   2025 653:01 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214671  0.3  0.3 1102176 65276 ?       Ssl   2025 650:42 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1215731  0.7  0.7 11714140 130408 ?     Ssl   2025 1449:50 node /home/sasa/dex8/dex8-api/starter.js
sasa     1216489  0.3  0.3 1100536 64356 ?       Ssl   2025 662:10 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1399960  0.8  0.6 11807324 109224 ?     Ssl  Apr20 292:39 node /home/sasa/dex8/dex8-www/server/index.js
sasa     1904154  0.6  0.6 11807752 100420 ?     Ssl  Apr25 162:05 node /home/sasa/miko/miko-hr/server/index.js
sasa     2628167  0.8  0.8 1176152 131924 ?      Ssl   2025 2300:06 node /home/sasa/voovuu/voovuu-api/starter.js
sasa     3168557  0.6  0.5 11802824 92168 ?      Ssl   2025 1676:47 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa     3169051  0.5  0.5 11799176 84088 ?      Ssl   2025 1388:48 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa     3264954  0.7  0.5 1332492 86736 ?       Ssl  Feb21 822:24 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js
sasa     3863978  0.3  0.3 1098844 63808 ?       Ssl  04:03   2:47 node /home/sasa/dex8/dex8-worker/starter.js
www-data 3930175  0.0  0.0   2608   524 ?        S    18:37   0:00 sh -c ps -aux | grep node
www-data 3930177  0.0  0.0   3304   708 ?        S    18:37   0:00 grep node