Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Regular expression for a certain amount of numbers/characters

I am new to regular expressions and I am struggling to find out how I can select a part of a value.

I have a property with a value 84.8234, I want to select only a part of this value: 84.82

How can I do this with a regular expression?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Image of what I want to do

>Solution :

You can use (\d\d\.\d\d)

see https://regex101.com/r/AIcCGg/1

(You can also write it as '\d{2}\.\d{2} but when there are only 2 repeats it’s longer to write it this way.)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading