Bengaluru, IN

Welcome to the Bengaluru User Group

Click the 'Join Group' button to get updates on group news and events.

How to use Regex or any other tool

Neeta_Latwal
7 - Meteor

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.NamountSourcedescriptionExpected Result 
1500con1234-56789-9587-234-firm paid234
2600ManualNeeta-ANXManual
3300ManualRAj-anx augManual
4400con1234-56789-9587-234-firm paid 555234
5900con5674-23478-567-firm paid 567
6100con23478-567-cash567

 

Thanks,

Neeta

1 REPLY 1
p-g
8 - Asteroid

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:

  1. 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.
  2. 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.
  3. 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! 🎉