Javascript - how to replace a sub-string?

后端 未结 4 2108
长情又很酷
长情又很酷 2021-02-19 16:37

This is a simple one. I want to replace a sub-string with another sub-string on client-side using Javascript.

Original string is \'original READ ONLY\'

4条回答
  •  抹茶落季
    2021-02-19 17:35

    Good summary. It is regexp based, if you use regexp notation you can specify the i and g modifiers (case insensitive (i), which will match regardless to case and global (g), which will replace all occurences), if you use string notation it'll get converted to a regex and you wont' be able to specify any modifier.

    
    

提交回复
热议问题