Home > Backend Development > PHP Tutorial > javascript - 用js,替换一段字符串当中以background-color: rgb为开头,

javascript - 用js,替换一段字符串当中以background-color: rgb为开头,

WBOY
Release: 2016-06-06 20:11:21
Original
1334 people have browsed it

用js,替换一段字符串当中以background-color: rgb为开头,以;结尾的字符串,替换为background-color: rgb(225,23,45);

回复内容:

用js,替换一段字符串当中以background-color: rgb为开头,以;结尾的字符串,替换为background-color: rgb(225,23,45);

<code>"background-color: rgb(afdf);".replace(/\b(background-color:\s*rgb)[^;\n]*;/g,"$1(255,23,45);")</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template