How to use Regex or any other tool
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
Neeta_Latwal
7 - Meteor
02-26-2024
01:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi All,
Below are my table i want to extract particular number which is belore the -firm paid, -bank and -firm paid 555.
Cloud you please help
S.N | amount | Source | description | Expected Result |
1 | 500 | con | 1234-56789-9587-234-firm paid | 234 |
2 | 600 | Manual | Neeta-ANX | Manual |
3 | 300 | Manual | RAj-anx aug | Manual |
4 | 400 | con | 1234-56789-9587-234-firm paid 555 | 234 |
5 | 900 | con | 5674-23478-567-firm paid | 567 |
6 | 100 | con | 23478-567-cash | 567 |
Thanks,
Neeta
1 REPLY 1
p-g
8 - Asteroid
02-26-2024
01:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
To extract the specific numbers before the phrases “-firm paid”, “-bank”, and “-firm paid 555” in Alteryx, you can use regular expressions (regex). Here’s how you can achieve this:
Extracting Numbers Before “-firm paid”:
- Use the Regex Tool in Alteryx.
- Set the Regular Expression to: .*-(\d+)-firm paid.*
- Select the Parse option for output.
- This will extract the numbers before the phrase “-firm paid” from your description column.
Extracting Numbers Before “-bank”:
- Similarly, use the Regex Tool.
- Set the Regular Expression to: .*-(\d+)-bank.*
- Again, select the Parse option for output.
- This will extract the numbers before the phrase “-bank” from your description column.
Extracting Numbers Before “-firm paid 555”:
- Once more, use the Regex Tool.
- Set the Regular Expression to: .*-(\d+)-firm paid 555.*
- Choose the Parse option for output.
- This will extract the numbers before the phrase “-firm paid 555” from your description column.
Remember to adjust the column names and field names according to your Alteryx workflow. Happy data wrangling! 🚀
Also, you can combine all three conditions into a single regular expression. Here’s how you can do it:
.*-(\d+)-(firm paid|bank|firm paid 555).*
Explanation:
- .* matches any characters (except newline) zero or more times.
- -(\d+) captures one or more digits after a hyphen.
- (firm paid|bank|firm paid 555) matches either “firm paid”, “bank”, or “firm paid 555”.
- The entire expression extracts the numbers before any of these phrases in your description column.
Feel free to use this combined regex in your Alteryx workflow! 🎉
