Reg Ex Parsing Help
- 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 need a little help to split some data. The data may or may not have 3 parts. If there is a first part then it will be enclosed by parentheses. Same with the 3rd part. Each part may contain multiple words. The components may or may not have numbers or punctuation. See the example below/ Any suggestions?
Solved! Go to Solution.
- Labels:
- Regex
- 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
Works on my test data. I'll try it on the actual production data later today just to be sure there were no other issues I didn't catch. What is the purpose of the ? at the end of the first and third marked groups? I'm also not exactly sure what the middle group is saying.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The "?" can mean lots of different things in regular expressions depending on how you use it. When used directly after a set, character or group it means capture 0 or 1. So (\(.*\))? means capture everything inside brackets either 0 or 1 time. This is important because, as you stated, the bracketed data at the start or end may or may not be there.
