[英]Regular expression to match linear-gradient and its content from a string
I get computed background style of an element and the result is like this: 我得到一个元素的计算背景样式,结果是这样的:
rgba(0, 0, 0, 0) linear-gradient(45deg, rgba(126, 47, 182, 0) 0%, rgba(126, 47, 182, 0) 25%, rgba(249, 71, 157, 0) 80%, rgba(249, 71, 157, 0) 100%) repeat scroll 0% 0% / auto padding-box border-box
What regular expression can I use to match only linear-gradient(45deg, rgba(126, 47, 182, 0) 0%, rgba(126, 47, 182, 0) 25%, rgba(249, 71, 157, 0) 80%, rgba(249, 71, 157, 0) 100%) 我可以使用什么正则表达式来仅匹配线性梯度(45deg,rgba(126,47,182,0)0%,rgba(126,47,182,0)25%,rgba(249,71,157,0 )80%,rgba(249,71,157,0)100%)
linear-gradient\([^(]*(\([^)]*\)[^(]*)*[^)]*\)
See demo in https://regex101.com/
请参阅
https://regex101.com/
演示
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.