regex match to find the middle string
- 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
Hi there,
i have a simple workflow here that I am trying to extract the middle two digit as shown in the table below.
I been using regex_match([AM],'\.\d{2}\.',1) in the formula tool to do the extraction however it keep returning me 0 as shown below. Please do let me know where did I made the mistake in the regex.
I had attached the workflow for reference. I do understand that i can opt to perform the extraction easily with text to column tool. However , i do have my reason why I would prefer to use formula tool instead as part of my larger workflow. Also , i would need to keep the [AM] column as string, hence i could not opt to convert to date format and extract the month instead.
expected output
Thanks.
Solved! Go to Solution.
- Labels:
- Regex
- Transformation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
SubString([AM],3, 2) should work! RegEx Match is only going to give you if it matches or if it doesn't
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
If you're trying to extract the middle two, you would need to use Regex parse, which requires the regex tool. You can do a formula without regex as well. Substring([AM],3,2) to extract this if this is always the format. For Regex parse, you would use "\d{2}:(\d{2}):\d{4}.*". Again that would always need to be the pattern.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@alexnajm I wish there was a way for pages to update with additional comments without having to refresh my browser!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks both!
both methods works for me really thanks alot!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Agreed @jdminton !
