Home > Enterprise >  Regular expression for a certain amount of numbers/characters
Regular expression for a certain amount of numbers/characters

Time:04-12

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?

Image of what I want to do

CodePudding user response:

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.)

  • Related