JavaScript Problem: Extracting a Decimal Number from a String

  Рет қаралды 2,787

All Things JavaScript, LLC

All Things JavaScript, LLC

Күн бұрын

Пікірлер: 9
@MecchaKakkoi
@MecchaKakkoi 4 жыл бұрын
If you want to filter out trailing full-stops/periods at the regex level and not rely on Number() to remove them, you could use something like the following: *let reg = /\d+(\.\d+)?/g;* Which is essentially saying, only include the decimal point if there is at least one digit after it.
@_chris_6786
@_chris_6786 4 жыл бұрын
Great solution. Thank you for teaching us!
@Hakeem-rk4ns
@Hakeem-rk4ns 4 жыл бұрын
You are the best ❤❤
@withgrowinginsanity198
@withgrowinginsanity198 4 жыл бұрын
Formatted amounts are tricky :) e.g. 12.489,56 (p.s. Thank you for turning my pure hatred towards JavaScript into tolerance :D )
@arunkaiser
@arunkaiser 4 жыл бұрын
Always Awesome 👌
@EitanPeles
@EitanPeles 4 жыл бұрын
great!
@rajeshsahu3073
@rajeshsahu3073 4 жыл бұрын
Nice video..
@mikaelkortbaoui8785
@mikaelkortbaoui8785 2 жыл бұрын
let reg = /\d+\,*\d*/g; for some reason doesn't work, it just print's out NAN
@AllThingsJavaScript
@AllThingsJavaScript 2 жыл бұрын
Please supply more of you code. A regular expression shouldn't produce NaN. It must be happening after, so curious what the rest of your code looks like.
JavaScript Problem: What is the Output?
7:20
All Things JavaScript, LLC
Рет қаралды 1,4 М.
JavaScript Problem: Extracting Numbers from a String
15:17
All Things JavaScript, LLC
Рет қаралды 9 М.
Gli occhiali da sole non mi hanno coperto! 😎
00:13
Senza Limiti
Рет қаралды 24 МЛН
Magic or …? 😱 reveal video on profile 🫢
00:14
Andrey Grechka
Рет қаралды 54 МЛН
JavaScript Tip: Avoiding Problems with Decimal Math
16:31
All Things JavaScript, LLC
Рет қаралды 11 М.
Learn Regular Expressions In 20 Minutes
20:52
Web Dev Simplified
Рет қаралды 1,3 МЛН
Learn JSON in 10 Minutes
12:00
Web Dev Simplified
Рет қаралды 3,2 МЛН
If __name__ == "__main__" for Python Developers
8:47
Python Simplified
Рет қаралды 400 М.
I've been using Redis wrong this whole time...
20:53
Dreams of Code
Рет қаралды 356 М.
This Simple Trick Makes Your Website 83% Better Looking
10:57
Web Dev Simplified
Рет қаралды 389 М.
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
pixegami
Рет қаралды 268 М.
7 Database Design Mistakes to Avoid (With Solutions)
11:29
Database Star
Рет қаралды 74 М.
Gli occhiali da sole non mi hanno coperto! 😎
00:13
Senza Limiti
Рет қаралды 24 МЛН