Regex_Match
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I have following scenario
Scenario : 1
Input:
data |
NRFB MC Pres 0704 |
DEBIT |
CREDIT |
NRFBMCPres7/4/2024 |
MCPres-07/04/2025 |
MC Pres001 |
$$mc Pres 7/01 |
MC$Pres$ 001 |
Expected output: whenever there is MC Pres in the data with any combination it should be shown in separate column
data | |
NRFB MC Pres 0704 | MC Pres |
DEBIT | |
CREDIT | |
NRFBMCPres7/4/2024 | MC Pres |
MCPres-07/04/2025 | MC Pres |
MC Pres001 | MC Pres |
$$mc Pres 7/01 | MC Pres |
MC$Pres$ 001 | MC Pres |
Scenario 2 :
DATA |
MC Prsntmnts 0704 |
NRFB MC Prsntmnts0704 |
RBmcPrsntmnts9/4/24 |
$Prsntmnts--07/04 |
MCPrsntmnts |
Expected Output
DATA | |
MC Prsntmnts 0704 | Prsntmnts |
NRFB MC Prsntmnts0704 | Prsntmnts |
RBmcPrsntmnts9/4/24 | Prsntmnts |
$Prsntmnts--07/04 | Prsntmnts |
MCPrsntmnts | Prsntmnts |
Scenario : 3
data |
121324 |
14312425256 |
52352352456 |
RRB |
52345234 |
GL CONTRA 091012 |
45363 |
FB092210 |
Expected Output: whenever the row starts with String then number from row should be extracted
data | |
121324 | |
14312425256 | |
52352352456 | |
RRB | |
52345234 | |
GL CONTRA 091012 | 91012 |
45363 | |
FB092210 | 92210 |
Note: All scenarios are different required output using different formulas for each
Solved! Go to Solution.
- Labels:
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@BRRLL99 Give us a look at what formula(s) you have tried so far
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You can try it in different formulas, but your data is a little messy. There is an "MC Pres" flagged in your sample that is actually "MCPres". For the first 2 use cases, I wouldn't use REGEX as it's simpler in a lookup table that you can keep adding to.
The 3rd though, is easier with REGEX. The formula I used will take all digits at the end of the string if the first character is from A-z: [A-z].*?(\d*)$
If you want to test a few, then go to regex101 or regexpal and put your sample data in then test a few variations of that if you want something slightly different.
