Regex for repeating characters
- 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 am trying to find regex for 2 types of situations:
1. where string has letters repeating 3 times in the beginning like aaatgre, rrryutu, yyyuiop,www-retdfdf etc
2. where string has letters repeating 3 times in the end like rtyuiii, tyrdyyy, iioottqqq etc.
Can someone help me in building the regex for these two scenarios. Thanks !
Solved! Go to Solution.
- Labels:
- Tips and Tricks
- 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 this solves the problem. Also i am looking for repeating characters in the first 3 and last 3 characters in a string. I was able to get the first 3 characters using Substring function. How to extract the last 3 characters of the string?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I'm glad that worked.
To get the last 3 characters: use the same method you did on the first 3 but on a reversed string using this function first: ReverseString(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
it worked! thanks a ton!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here is a bit quicker solution using RegEx if you want to implement. I've parsed the text from the opening three characters and the ending three characters. \l is shorthand for undercase, so if the letters are all upper case, use \u, if they are combination of upper and lower, use \w an make sure the "case insensitive" box is checked in the configuration window.
Sean
