Pavel Minaev
8/13/2008 6:34:00 AM
On Aug 13, 2:11 am, Igor <I...@discussions.microsoft.com> wrote:
> Hi all,
>
> I need to create a regular expression to have a match if first 5 characters
> of the string are the same as last 5 characters of the same string. And
> that’s easy:
> ^(?<group1>\w{5})\w*\k<group1>$
>
> Now’s the challenge (at least for me). First 5 characters are lowercase and
> the last 5 characters is upper case, but match is still has to happen.
> Converting the input string to upper/lower case is not an option as it'll
> break other functionality.
>
> I'm not sure if it's doable. Any help would be greatly appreciated.
It doesn't seem to be doable with a single regex, but it doesn't seem
to be a good case for using one, anyway. Why not just use Substring()
and Equals() as needed?