..:: 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 1305000 72472 ?       Ssl   2025 1166:53 node /home/sasa/dex8/dex8-panel/server/index.js
sasa        1236  0.5  0.6 11819984 104956 ?     Ssl   2025 1843:14 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa        1257  0.3  0.4 1303816 71508 ?       Ssl   2025 1183:02 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1289  0.3  0.4 1297836 67256 ?       Ssl   2025 1165:08 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1363  4.3  3.0 12199024 501528 ?     Ssl   2025 14832:11 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1886  5.6  3.5 12248240 586700 ?     Ssl   2025 19356:52 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
sasa     1214480  0.3  0.7 22311168 125880 ?     Ssl   2025 924:01 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214483  0.3  0.4 1101056 65696 ?       Ssl   2025 831:26 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214536  0.3  0.4 1101060 66416 ?       Ssl   2025 829:50 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214544  0.3  0.4 1101544 66280 ?       Ssl   2025 836:16 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214588  0.3  0.4 1101572 65536 ?       Ssl   2025 832:04 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214617  0.3  0.4 1102976 68168 ?       Ssl   2025 829:23 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214641  0.3  0.3 1166184 64480 ?       Ssl   2025 819:56 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214671  0.3  0.4 1101664 66324 ?       Ssl   2025 816:40 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1215731  0.7  0.7 11843932 124696 ?     Ssl   2025 1725:53 node /home/sasa/dex8/dex8-api/starter.js
sasa     1216489  0.3  0.3 1101560 65172 ?       Ssl   2025 829:02 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1399960  0.8  0.7 11835108 124448 ?     Ssl  Apr20 699:08 node /home/sasa/dex8/dex8-www/server/index.js
sasa     1631573  0.4  0.4 1302284 77564 ?       Ssl  May31 110:13 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa     1904154  0.6  1.0 11906308 172496 ?     Ssl  Apr25 474:03 node /home/sasa/miko/miko-hr/server/index.js
sasa     2628167  0.8  0.8 1176796 132360 ?      Ssl   2025 2642:27 node /home/sasa/voovuu/voovuu-api/starter.js
sasa     3168557  0.6  0.6 11837240 114120 ?     Ssl   2025 1968:51 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa     3169051  0.5  0.5 11799176 83952 ?      Ssl   2025 1639:59 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa     3264954  0.7  0.5 1333192 87308 ?       Ssl  Feb21 1182:26 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js
sasa     3605559  0.3  0.4 1103196 67912 ?       Ssl  Jun17   3:49 node /home/sasa/dex8/dex8-worker/starter.js
www-data 3691067  0.0  0.0   2608   588 ?        S    00:09   0:00 sh -c ps -aux | grep node
www-data 3691069  0.0  0.0   3304   644 ?        S    00:09   0:00 grep node