..:: 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 1313024 76796 ?       Ssl   2025 1447:24 node /home/sasa/dex8/dex8-panel/server/index.js
sasa        1236  0.5  0.6 11823740 102260 ?     Ssl   2025 2285:24 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa        1257  0.3  0.4 1308516 74220 ?       Ssl   2025 1465:02 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1289  0.3  0.4 1301776 69556 ?       Ssl   2025 1443:23 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1363  4.2  3.5 12320468 586956 ?     Ssl   2025 18376:20 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1886  7.0  3.7 12274556 609084 ?     Ssl   2025 30453:29 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
sasa     1214480  0.3  0.7 22311168 124816 ?     Ssl   2025 1233:59 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214483  0.3  0.4 1101824 65732 ?       Ssl   2025 1127:59 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214536  0.3  0.4 1101060 66064 ?       Ssl   2025 1126:24 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214544  0.3  0.4 1102056 66452 ?       Ssl   2025 1135:33 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214588  0.3  0.3 1102340 65212 ?       Ssl   2025 1129:37 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214617  0.3  0.4 1101952 66496 ?       Ssl   2025 1125:41 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214641  0.3  0.4 1169000 67108 ?       Ssl   2025 1117:07 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1214671  0.3  0.3 1100384 64204 ?       Ssl   2025 1111:48 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1215731  0.8  0.7 11845820 123244 ?     Ssl   2025 2814:40 node /home/sasa/dex8/dex8-api/starter.js
sasa     1216489  0.3  0.3 1101560 65236 ?       Ssl   2025 1125:59 node /home/sasa/dex8/dex8-worker/starter.js
sasa     1399960  0.8  0.7 11832096 121056 ?     Ssl  Apr20 1505:46 node /home/sasa/dex8/dex8-www/server/index.js
sasa     1631573  0.4  0.6 1322720 100392 ?      Ssl  May31 565:49 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa     1824679  0.4  0.5 11798592 83944 ?      Ssl  Aug15  28:09 node /home/sasa/kriptus/kriptus-panel/server/index.js
sasa     1835274  2.3  0.7 11850588 130188 ?     Ssl  Aug15 148:09 node /home/sasa/kriptus/kriptus-api/starter.js
sasa     1904154  0.7  1.2 11901844 204240 ?     Ssl  Apr25 1194:07 node /home/sasa/miko/miko-hr/server/index.js
sasa     2290419  0.3  0.3 1096028 61196 ?       Ssl  04:02   0:14 node /home/sasa/dex8/dex8-worker/starter.js
www-data 2295921  0.0  0.0   2608   528 ?        S    05:16   0:00 sh -c ps -aux | grep node
www-data 2295923  0.0  0.0   3304   716 ?        S    05:16   0:00 grep node
sasa     2628167  0.7  0.7 1175516 129988 ?      Ssl   2025 3295:35 node /home/sasa/voovuu/voovuu-api/starter.js
sasa     3168557  0.6  0.7 11853148 115528 ?     Ssl   2025 2550:10 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa     3169051  0.5  0.5 11799488 83680 ?      Ssl   2025 2090:40 node /home/sasa/@mikosoft/dodo-examples/server/index.js
sasa     3264954  0.6  0.5 1333448 86976 ?       Ssl  Feb21 1800:20 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js