Regex Tool usage – Alteryx Community

daHi All please help me to find out the desired output only through REGEX tool. There are 5 questions that I am struggling with.

 

1 Required : Only last two letter of string.     4 Required :  where AF in the last pick “AF” and if Diff is at start then pick “Diff”
    Input Output       Input Output    
    City City       Category Category    
    Delhi hi       London_File_AF AF    
    Mumbai ai       Diff_London_File Diff    
              UK_File_AF AF    
2 Required :  Only required first and last word of string         Diff_UK_File Diff    
    Input Output              
    Category Category   5 Required :  Delimeter split (_)      
    Zebra Crossing Republic Zebra Republic       Input Output
    John Smith Crossing John Crossing       Category R1 R2 R3
              London_File_AF London File AF
3 Required :  Only required last word of string         Diff_London_File Diff London File
    Input Output              
    Category Category              
    Zebra Crossing Republic Republic              
    John Smith Crossing Crossing              
                     
                     

Read more here: Source link