How to use Regex function to extract numbers(with decimals) from a string?
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
rajputakansha
8 - Asteroid
‎06-01-2023
03:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello,
I have a scenario where I need extract amounts from a string. This could be achieved either by using regex function or pulling amounts from the end of the strings.
Can someone suggest a dynamic solution to this problem?
Field | Output |
0,AAA None]||||ABB_BALANCE|90 | 90 |
0,AAA None]||||ABB_BALANCE|0 | 0 |
0,AAA None]||||ABB_BALANCE|0 | 0 |
0,AAA None]||||ABB_BALANCE|80.30 | 80.3 |
0,AAA None]||||ABB_BALANCE|0 | 0 |
0,AAA None]||||ABB_BALANCE|0 | 0 |
0,AAA None]||||ABB_BALANCE|0 | 0 |
0,AAA None]||||ABB_BALANCE|9999 | 9999 |
0,AAA None]||||ABB_BALANCE|0 | 0 |
1463.49,AAA None]||||ABB_BALANCE|1463.49 | 1463.49 |
1463.49,AAA None]||||ABB_BALANCE|1463.49 | 1463.49 |
Thank you
Labels:
- Labels:
- Input
- Output
- Parse
- Regex
- Tips and Tricks
3 REPLIES 3
smoosh
8 - Asteroid
‎06-01-2023
03:56 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I'm sure someone will post a better answer, but give the attached workflow a shot. It works correctly on your sample data.
Also, I find this site a great resource for playing with RegEx, and getting a better understanding of what it's doing and why.
Good luck.
alisonpitt
11 - Bolide
‎06-01-2023
05:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
acarter881
12 - Quasar
‎06-01-2023
05:46 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello, @rajputakansha.
Please see the attached workflow.
I believe this RegEx will work for you: ([^|]*)$.
