Home > Backend Development > PHP Tutorial > javascript - How to propose a price rule

javascript - How to propose a price rule

WBOY
Release: 2016-08-04 09:21:03
Original
1025 people have browsed it

javascript - How to propose a price rule

最终匹配到2499.00,正则该怎么样写;

回复内容:

javascript - How to propose a price rule

最终匹配到2499.00,正则该怎么样写;

直接这样可以吗 substr("¥2499.00",3);

<code>("¥2,499,999.00").replace("¥","").replace(/,/g,"");

("¥499,999.00").replace(/[^\d\.]/g,"");
</code>
Copy after login

<code>"¥2,499.00".match(/¥([\d,]*?\.00)/)[1]
//2499.00
"¥2,99.00".match(/¥([\d,]*?\.00)/)[1]
//299
</code>
Copy after login

<code>var str='¥2,499.00';
str.replace(/[¥,]/g,''); // => 2499.00</code>
Copy after login

<code>var str = '$2,499.00';
str.match(/[\d.]/g).join('');</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