Home >Web Front-end >JS Tutorial >The string replacement function replace() method in javascript is a little different from c# and vb replacement_javascript skills

The string replacement function replace() method in javascript is a little different from c# and vb replacement_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:24:351211browse

1.

Result: Only the first character a of the string is replaced. This is not the result I want↓


2.replace() supports regular expressions, it can be as follows Regular expression rules match characters or strings and then give replacement!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn