..:: 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 1308160 73352 ?       Ssl   2025 1509:36 node /home/sasa/dex8/dex8-panel/server/index.js
sasa        1236  0.5  0.6 11824068 101420 ?     Ssl   2025 2383:37 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa        1257  0.3  0.4 1308260 74252 ?       Ssl   2025 1528:11 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1289  0.3  0.4 1301520 68912 ?       Ssl   2025 1505:19 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1363  4.2  3.8 12334636 633552 ?     Rsl   2025 19354:58 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1886  7.3  3.7 12274044 606508 ?     Ssl   2025 33055:33 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
sasa     1214480  0.3  0.7 22311168 123612 ?     Ssl   2025 1302:48 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214483  0.3  0.3 1101568 64452 ?       Ssl   2025 1193:51 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214536  0.3  0.3 1100804 64976 ?       Ssl   2025 1192:15 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214544  0.3  0.4 1102568 65708 ?       Ssl   2025 1201:58 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214588  0.3  0.3 1102340 65140 ?       Ssl   2025 1195:46 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214617  0.3  0.3 1101952 65224 ?       Ssl   2025 1191:35 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214641  0.3  0.3 1166440 63268 ?       Ssl   2025 1183:05 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214671  0.3  0.3 1099872 63388 ?       Ssl   2025 1177:22 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1215731  0.8  0.7 11840580 116668 ?     Ssl   2025 3113:43 node /home/sasa/dex8/dex8-api/starter.js
sasa     1216489  0.3  0.3 1102072 65232 ?       Ssl   2025 1192:02 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1399960  0.8  1.2 11892604 197268 ?     Rsl  Apr20 1711:12 node /home/sasa/dex8/dex8-www/server/index.js
sasa     1631573  0.4  0.5 1314924 93388 ?       Ssl  May31 675:39 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa     1824679  0.4  0.5 11798848 82084 ?      Ssl  Aug15 121:05 node /home/sasa/kriptus/kriptus-panel/server/index.js
sasa     2448036  1.0  0.9 11872468 153568 ?     Ssl  Aug21 183:44 node /home/sasa/miko/miko-hr/server/index.js
sasa     2628167  0.7  0.7 1178844 130372 ?      Rsl   2025 3455:12 node /home/sasa/voovuu/voovuu-api/starter.js
sasa     2663246  2.8  0.7 11851796 127268 ?     Ssl  Aug23 433:03 node /home/sasa/kriptus/kriptus-api/starter.js
sasa     3168557  0.6  0.5 11806044 94256 ?      Rsl   2025 2663:13 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa     3169051  0.5  0.5 11799488 83056 ?      Ssl   2025 2191:04 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa     3264954  0.6  0.5 1333120 85836 ?       Ssl  Feb21 1937:03 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js
sasa     3358795  0.5  0.4 1260928 81472 ?       Ssl  Aug29  37:23 node /home/sasa/miko/miko-hr/api/starter.js
sasa     3809381  0.3  0.5 11797540 85964 ?      Ssl  Sep02   4:54 node /home/sasa/dex8/dex8-worker/starter.js
www-data 3923848  0.0  0.0   2608   528 ?        S    05:39   0:00 sh -c ps -aux | grep node
www-data 3923850  0.0  0.0   3304   652 ?        S    05:39   0:00 grep node