Regex: Remove everything except a specific pattern
- 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 i been looking for some hours in internet but i didn't figure out this problem yet
i have some records like this:
Random KEY1 Text KEY3
Blah Blah KEY10
Hello World KEY5
KEY22 another text KEY1
And my desired result is this:
KEY1 KEY3
KEY10
KEY5
KEY22 KEY1
basically i want to remove everything in a string except these KEY ID's
Thanks
Solved! Go to Solution.
- Labels:
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Can you provide some actual input data, mocked up if necessary? Does the text you want actually include the work KEY in all caps, followed by one or more numbers?
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Pablo_Sahonero ,
Find attached the way of doing this with simple Regex expression : (KEY\d+?)
Let me know if there is any issue.
Please do not hesitate to mark this answer as solution if it helped.
- 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
yes KEY is always going to be in capital followed by a number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
thanks for the responses
the solutions indeed "works" but the problem is i can have more than 2 occurrences within a single record
you may say ok split it in more columns BUT i don't know how many occurrences can be
it's there a way of using regex replace instead of tokenize?
EDIT: i tried using replace with the regexs provided but i get the opposite that i wanted:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
