[yunqa.de] Re: Converting upper case strings to lower case with regular expression

  • From: Sheri <silvermoonwoman@xxxxxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Wed, 25 Nov 2009 16:54:29 -0500

Jim Bretti wrote:
Sorry I didn't explain that better.

My application allows the user to do text manipulations using regular expressions. The application builds search/replace expressions based on match patterns and format patterns supplied by the user. So what I'm looking for is a way for the user to supply a match pattern that matches upper case strings in the text, and have the strings converted to lower case.

For example:
Match Pattern:    ([A-Z]{3,})
Format Pattern:   LowerCase($1)

So if there was a LowerCase function like this, this expression would locate upper case strings in the text 3 characters or longer, and convert to lower case.

I'm just wondering if there is a way to do this without needing to set up something in my app to handle case conversions.

Jim


Delphi Inspiration wrote:
> At 18:45 25.11.2009, Jim Bretti wrote:
>
> >> Is it possible to search for upper case strings and convert to lower case, without coding the case conversion? >> >
> I am not sure what exactly you want to achieve. Can you please elaborate?
>
> Ralf
DIRegex is used in an editor I use. I and others still wish for this capability. From an exchange we had a couple years ago:

>>> this is a suggested enhancement: A few other programs
>>> I use or helped design allow "$" to be optionally followed by u,
>>> U, l, L, t or T to cause the string referenced to be forced to
>>> upper, lower or title case in output.
>> >>
>> I already though about case modifiers, but did not add them
>> because I could not find a regex replace syntax standard.
>
> > I would encourage you to reconsider. Whatever syntax you choose
> would become the standard for your users (and their users).
> There's no problem making case alterations during substitutions
> in Perl, but Perl evaluation is not available to a PCRE based
> operation. In PHP you can use a preg_replace_callback to achieve
> it. Both AutoHotkey and PowerPro use the single letter case
> signals after the dollar sign, which is really nice and easy.
> Text case is both natural and universally needed at one time or
> another when making regex replacements.

Regards,
Sheri
_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: