Usage of extract regex Values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
30-03-21 02:09 PM
Hi guys,
i've some problems with using the "extract regex values".
I need to extract only number inside my string values.
EX. --> 998,145lb $ i need to extract 998145.
I've found this pattern "\d+(\.\d{1,2})?" and i have 2 matches 998 and 145.
Is this pattern correct? I've tried with the test regex and the match is True but when i try to configure the extract regex values the collection is empty.
So, my goal is to extract this text from a collection field (inside a loop) and then re-insert the correct data inside my collection, which is the best method to do that?
Thanks in advance
------------------------------
Vrat Himbo
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
30-03-21 05:13 PM
There are lots of different ways to match just numbers. The most basic is is simply \d+. However, this will match each individual digit. Since you want to match complete numbers you can apply grouping as this (\d+). This will match only digits and will keep them in groups, so instead of getting 9 9 8 1 4 5 it will group them as 998 and 145.
Cheers,
------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
30-03-21 06:23 PM
how can I configure the collection in input and output to have the single value 998145?
I haven't found bp documentation about this object.
Thanks,
------------------------------
Vrat Himbo
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
30-03-21 08:52 PM
Cheers,
------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
30-03-21 09:57 PM
Thanks,
------------------------------
Vrat Himbo
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
30-03-21 10:18 PM
To answer your specific example, you'd want go with a regex like this (?<Group1>\d+)\D(?<Group2>\d+). Then you would want to populate two rows in the Named Values collection and set the Name of each row to Group1 and Group2 respectively. When you run it, the response collection will look like this:
After that, it's just a matter of cycling through that collection and concatenating the values together into your new collection.
Cheers,
------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
31-03-21 04:31 PM
last question, in your opinion is a good approach to loop inside the collection and use the "replace" function if i have a fixed value?
For example: 998.145 $ Replace(Trim("collection.Invoice","$",""))
and the same for the comma?
Thanks in advance
------------------------------
Vrat Himbo
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
31-03-21 05:00 PM
Cheers,
------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
21-06-21 12:33 PM
Thanks for your reply!
As I was searching for this for hours. It would benefit others if there's a bit screenshots explaining what is discussed here.
1. Set up the Data item
2. Set up a collection with "Fields" and "Initial Values"
3. Set up an action. In the "Regex Pattern", use the correct format "(?<Name (Text)>)RegEx"
* Name (Text), this is what you wrote in the collection initial value
* RegEx, this is normal RegEx pattern
4. The collection will now have 1 matched result
------------------------------
Hao Wu
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
22-06-21 07:28 PM
Hello Hao Wu,
Great initiative compiling the solution.
Made my life easy.
------------------------------
------------------------------
Best Regards,
Ved Sengupta
RPA Developer
Bangalore | INDIA
------------------------------
------------------------------
