Showing posts with label RegExp. Show all posts
Showing posts with label RegExp. Show all posts
Wednesday, September 27, 2017
Get int or float number from a string
Number("this a test (12.75%)".match(/\d*\.*\d+/g)[0]); // Output: 12.75
Etiquetes de comentaris:
JavaScript,
RegExp
Wednesday, October 28, 2015
Extracts a word which starts with a given substring
// extracts js_* class
$(anySelector).attr('class').match(/\bjs_[^\b]*?\b/)[0];
$(anySelector).attr('class').match(/\bjs_[^\b]*?\b/)[0];
Etiquetes de comentaris:
JavaScript,
jquery UI,
RegExp
Subscribe to:
Posts (Atom)