Extract Digits from the text line
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
16-10-18 12:06 PM
Hello,
I've a use case where in i wanted to extract digits from the below sample text. Can someone help me to resolve this?
"CDH Investments Join $14.5M Round In Chinese Online Education Firm Longzhimen"
Thanks,
8 REPLIES 8
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
16-10-18 06:45 PM
I would suggest regexp, unless text around the number is static - then just replace ""CDH Investments Join $"" and ""M Round In Chinese Online Education Firm Longzhimen"" with """" and you have your digits.

Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
16-10-18 08:17 PM
CDH Investments Join $14.5M Round In Chinese Online Education Firm Longzhimen --> Store this in data Item. Now use the calculation stage and use Length function store it in data item now take 2nd calculation stage and find the position of ""$"" using Instr function and store in data item again use calculation stage use Instr function and expression should be ""Total Length of string"", Total Length of string - Postion length.
I hope this will help.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
17-10-18 10:37 AM
@aikudino
text is not static hence replace would not work,
Can you please share Regex Pattern to extract ""14.5"" for the said string?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
17-10-18 10:39 AM
@Saumitra
I tried your suggestion and it will work for $ cases but the currency is not static and will chance form case to case.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
17-10-18 04:59 PM
Simple one is: ""[\d\.]+"" (that will match something like 127.0.0.1 too if it happens to be in input), ""\d+(\.\d+)?"" is better to match float.
Seems like you don't care about M suffix...
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
19-10-18 06:40 PM
Thanks aikudino
It works with small ticks.
""([$](\d+)([.]*)[\d*])
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-04-22 11:38 AM
Hi, could you please explain how did it work? I have the same usecase as below and need to extract 2.65 and then 8 etc., This text is in collection
Deducted amount 2345 as of 28/03/22 for rate 2.65 per scheme
Deducted amount 678 as of 8/02/22 for rate nxy 8 per scheme
------------------------------
Navaneetha Thupalli
------------------------------
Deducted amount 2345 as of 28/03/22 for rate 2.65 per scheme
Deducted amount 678 as of 8/02/22 for rate nxy 8 per scheme
------------------------------
Navaneetha Thupalli
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-04-22 01:59 PM
Hi N,
If your search this community for 'regex' threads, you'll find a lot of examples and instructions on how to accomplish that. There's also this site to help you further with regex.
------------------------------
Happy coding!
Paul
Sweden
------------------------------
If your search this community for 'regex' threads, you'll find a lot of examples and instructions on how to accomplish that. There's also this site to help you further with regex.
------------------------------
Happy coding!
Paul
Sweden
------------------------------
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)
Paul, Sweden
(By all means, do not mark this as the best answer!)
