..:: 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 1313472 72524 ?       Ssl   2025 1415:11 node /home/sasa/dex8/dex8-panel/server/index.js
sasa        1236  0.5  0.6 11822724 100148 ?     Ssl   2025 2234:33 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa        1257  0.3  0.4 1308260 73972 ?       Ssl   2025 1432:31 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1289  0.3  0.4 1301776 69504 ?       Ssl   2025 1411:23 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1363  4.2  3.6 12340204 604416 ?     Ssl   2025 17954:09 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1886  6.9  3.6 12270624 604620 ?     Ssl   2025 29173:18 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
sasa     1214480  0.3  0.7 22311168 124720 ?     Ssl   2025 1198:25 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214483  0.3  0.4 1101568 65884 ?       Ssl   2025 1093:59 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214536  0.3  0.4 1101316 65532 ?       Ssl   2025 1092:25 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214544  0.3  0.4 1102312 65544 ?       Ssl   2025 1101:13 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214588  0.3  0.4 1102340 65548 ?       Ssl   2025 1095:25 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214617  0.3  0.4 1102208 65888 ?       Ssl   2025 1091:44 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214641  0.3  0.3 1166184 64144 ?       Ssl   2025 1083:04 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214671  0.3  0.4 1102176 66252 ?       Ssl   2025 1077:58 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1215731  0.8  0.7 11844796 122436 ?     Ssl   2025 2758:08 node /home/sasa/dex8/dex8-api/starter.js
sasa     1216489  0.3  0.4 1102840 66768 ?       Ssl   2025 1091:53 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1399960  0.8  0.7 11832096 120132 ?     Ssl  Apr20 1419:47 node /home/sasa/dex8/dex8-www/server/index.js
sasa     1463481  0.3  0.3 1099360 64172 ?       Ssl  Aug12   4:28 node /home/sasa/dex8/dex8-worker/starter.js
www-data 1563705  0.0  0.0   2608   596 ?        S    03:10   0:00 sh -c ps -aux | grep node
www-data 1563707  0.0  0.0   3304   720 ?        S    03:10   0:00 grep node
sasa     1631573  0.4  0.6 1321776 99528 ?       Ssl  May31 520:35 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa     1904154  0.6  0.9 11891308 163032 ?     Ssl  Apr25 1087:22 node /home/sasa/miko/miko-hr/server/index.js
sasa     2628167  0.7  0.7 1176028 130272 ?      Ssl   2025 3219:10 node /home/sasa/voovuu/voovuu-api/starter.js
sasa     3168557  0.6  0.6 11831340 107604 ?     Ssl   2025 2486:06 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa     3169051  0.5  0.5 11799488 83024 ?      Ssl   2025 2038:47 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa     3264954  0.6  0.5 1333448 86852 ?       Ssl  Feb21 1729:58 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js