..:: 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        1208  0.3  0.4 1309664 75112 ?       Ssl   2025 1296:54 node /home/sasa/dex8/dex8-panel/server/index.js
sasa        1236  0.5  0.6 11824336 100716 ?     Ssl   2025 2047:32 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa        1257  0.3  0.4 1304072 71344 ?       Ssl   2025 1313:02 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1289  0.3  0.4 1298428 67216 ?       Ssl   2025 1293:54 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1363  4.2  3.2 12243248 528632 ?     Ssl   2025 16105:28 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1886  6.4  3.5 12247216 580388 ?     Ssl   2025 24482:02 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
sasa     1214480  0.3  0.7 22311168 125668 ?     Ssl   2025 1067:32 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214483  0.3  0.4 1101312 66508 ?       Ssl   2025 968:46 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214536  0.3  0.4 1102852 67584 ?       Ssl   2025 967:15 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214544  0.3  0.4 1101032 65616 ?       Ssl   2025 974:55 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214588  0.3  0.4 1101828 65892 ?       Ssl   2025 969:46 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214617  0.3  0.4 1100928 65748 ?       Ssl   2025 966:39 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214641  0.3  0.3 1166184 64276 ?       Ssl   2025 957:40 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214671  0.3  0.3 1100640 64500 ?       Ssl   2025 953:31 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1215731  0.6  0.7 11845212 125556 ?     Ssl   2025 1953:25 node /home/sasa/dex8/dex8-api/starter.js
sasa     1216489  0.3  0.4 1102584 66756 ?       Ssl   2025 966:36 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1399960  0.8  0.7 11828828 115628 ?     Ssl  Apr20 1061:16 node /home/sasa/dex8/dex8-www/server/index.js
sasa     1631573  0.4  0.5 1303808 81996 ?       Ssl  May31 291:01 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa     1904154  0.6  0.8 11834532 136188 ?     Ssl  Apr25 786:10 node /home/sasa/miko/miko-hr/server/index.js
sasa     2545035  0.3  0.5 22292356 96884 ?      Ssl  Jul15   7:54 node /home/sasa/dex8/dex8-worker/starter.js
sasa     2628167  0.8  0.8 1177052 132724 ?      Ssl   2025 2926:14 node /home/sasa/voovuu/voovuu-api/starter.js
www-data 2719764  0.0  0.0   2608   532 ?        S    19:18   0:00 sh -c ps -aux | grep node
www-data 2719766  0.0  0.0   3304   644 ?        S    19:18   0:00 grep node
sasa     3168557  0.6  0.6 11832724 110428 ?     Ssl   2025 2261:11 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa     3169051  0.5  0.5 11799488 84476 ?      Ssl   2025 1848:36 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa     3264954  0.7  0.5 1332680 86264 ?       Ssl  Feb21 1469:20 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js