Reg Ex tool Parse
- 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 all,
I'm still learning the regex tool and i'm struggling with something that is really simple:
i have this:
address | reg ex out 1 | reg ex out 2 |
12 bobton lane | 12 | bobton lane |
levi lane | levi lane |
i cant seem to get the right expression to show both examples ? could someone be so kind to explain how to split those out? - i'm sure its simple i'm just not writing the expression correctly
Solved! Go to Solution.
- Labels:
- Expression
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How does this look @berty? Because both of the addresses don't have a number element, even though you want to split that out if present, I've just made that capture group optional with the ? notation. By the way, this assumes the same address formats so let me know if they can differ or if this doesn't work when applied to a wider dataset and can look to amend it.
(\d+)?\s?(.+)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@DataNath - this was perfect, i just found a little issue that I'm not sure how i configure this..
i have this address 77-79 yardman close and it seems to split like this
77-79 yardman close | 77 | -79 yardman close |
how can i get -79 added to field showing 77?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey @berty no worries - thanks for the example! Give this a try and again let me know if you come across any further issues :)
([0-9-]+)?\s?(.+)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@berty Adding to @DataNath solution, I have created below regex code in case you get other character as well such as space or underscore in lane number. It will dynamically capture those details.
(.+\d\b)?\s?(.+)
1. First capturing group : it will match everything till boundary of last digit. In this case it will be 77-79
2. Second capturing group : it will match remaining part as lane name.
