Using RegEx to convert a collection of city names alternatively to upper and lower case using built in regex functions

Using RegEx to convert a collection of city names alternatively to upper and lower case using built in regex functions.

For eg if the collection has city names Bangalore, Chennai and Hyderabad, i want the output as:

BaNgAlOrE
ChEnNaI
HyDeRaBaD
using only regex functions and no character arrays

@Purnima_Sambasivan
Welcome to the forum

Have a look here

2 Likes

wow… yet to understand the usages of Regex. Thank you so much ,

@Purnima_Sambasivan
Unfortunately the \U \L is not supported in .Net RegEx World

But we can do it with:
Regex.Replace(strText, searchPattern, (Function (m) m.Groups(1).Value.toUpper +m.Groups(2).Value.toLower) )

Find a starter Help here
RegExReplace_ToUpperToLower.xaml (5.0 KB)

1 Like

Thank you so much !

@Purnima_Sambasivan
Perfect. So when it is solved just mark the solving post as solution or let us know your open question. Other forum members can benefitfrom it. Thanks

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.