Match Centimeters

A swapping-ground for Regular Expression syntax

Match Centimeters

Postby trevzilla » Sat Oct 12, 2019 9:43 pm

I have several strings that have the following format:

[{"Feet & Inches":"5'5","CM":"165.1"}]
[{"Feet & Inches":"5'3","CM":"160.02"}]
[{"Feet & Inches":"6'1","CM":"185.42"}]

And so on and so forth. I'm trying to pull out just the CM characters...e.g. just match the following:

165.1
160.02
185.42

And so on and so forth.

Any help with this RegEx would be greatly appreciated! Thanks!
trevzilla
 
Posts: 5
Joined: Fri Jun 02, 2017 12:31 am

Re: Match Centimeters

Postby trevzilla » Sat Oct 12, 2019 10:36 pm

Nevermind! I think I got something that works:

\d{2,3}.\d{1,}

I don't think I'll have anything other than 2 or 3 digits before the period, and I should always have 1 digit after the period. I hope this works!
trevzilla
 
Posts: 5
Joined: Fri Jun 02, 2017 12:31 am

Re: Match Centimeters

Postby therube » Sun Oct 13, 2019 1:34 pm

Thinking you'll want to escape the (dot) too.

\d{2,3}\.\d{1,}
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm


Return to Regular Expressions