..:: 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 1311200 75196 ?       Ssl   2025 1353:54 node /home/sasa/dex8/dex8-panel/server/index.js
sasa        1236  0.5  0.6 11819600 99412 ?      Ssl   2025 2137:15 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa        1257  0.3  0.4 1304072 71116 ?       Ssl   2025 1370:34 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1289  0.3  0.4 1301520 70044 ?       Ssl   2025 1350:41 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1363  4.1  3.6 12329184 593712 ?     Ssl   2025 16751:54 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1886  6.6  3.6 12264132 599704 ?     Ssl   2025 26808:55 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
sasa     1214480  0.3  0.7 22311168 125280 ?     Ssl   2025 1130:53 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214483  0.3  0.4 1101568 65968 ?       Ssl   2025 1029:18 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214536  0.3  0.4 1101060 65784 ?       Ssl   2025 1027:50 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214544  0.3  0.4 1101544 66048 ?       Ssl   2025 1036:00 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214588  0.3  0.3 1101572 64968 ?       Ssl   2025 1030:34 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214617  0.3  0.4 1100672 65880 ?       Ssl   2025 1027:10 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214641  0.3  0.3 1166440 64872 ?       Ssl   2025 1018:19 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214671  0.3  0.4 1102432 66488 ?       Ssl   2025 1013:43 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1215731  0.7  0.7 11845988 126644 ?     Ssl   2025 2187:51 node /home/sasa/dex8/dex8-api/starter.js
sasa     1216489  0.3  0.4 1101560 65992 ?       Ssl   2025 1027:08 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1399960  0.8  0.7 11817052 120576 ?     Ssl  Apr20 1210:40 node /home/sasa/dex8/dex8-www/server/index.js
sasa     1631573  0.4  0.4 1303556 81440 ?       Ssl  May31 382:20 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa     1904154  0.6  0.8 11835508 137272 ?     Ssl  Apr25 928:45 node /home/sasa/miko/miko-hr/server/index.js
sasa     2628167  0.7  0.7 1175516 130808 ?      Ssl   2025 3055:59 node /home/sasa/voovuu/voovuu-api/starter.js
sasa     3168557  0.6  0.6 11811008 102316 ?     Ssl   2025 2370:54 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa     3169051  0.5  0.5 11799488 83924 ?      Ssl   2025 1940:19 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa     3264954  0.7  0.5 1333192 87520 ?       Ssl  Feb21 1596:35 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js
sasa     4045488  0.2  0.3 1099096 63452 ?       Ssl  Jul29   3:55 node /home/sasa/dex8/dex8-worker/starter.js
www-data 4144539  0.0  0.0   2608   596 ?        S    02:17   0:00 sh -c ps -aux | grep node
www-data 4144541  0.0  0.0   3304   656 ?        S    02:17   0:00 grep node