Skip to content

Latest commit

 

History

History
11 lines (7 loc) · 533 Bytes

File metadata and controls

11 lines (7 loc) · 533 Bytes

আমরা পূর্বের চ্যাপ্টারে ডেসিমেল সংখ্যা কে অপশনাল রেখে খুঁজার উপায় দেখেছিলাম: pattern:\d+(\.\d+)?

ঋণাত্নক সংখ্যা খুঁজার জন্য শুরুতে pattern:- কে অপশনাল হিসেবে যোগ করি:

let regexp = /-?\d+(\.\d+)?/g;

let str = "-1.5 0 2 -123.4.";

alert( str.match(regexp) );   // -1.5, 0, 2, -123.4