if what you are trying to do is change 'M' for the string 'U+1E43' you can try using a hash:
%table = ( M => 'U+1E43'); # or maybe ( M => "\x{1E43}") $string =~ s< {(.*?)} > < '{'.(join '', map { $table{$_} || $_ } split //, $1).'}'; >exg; or you can try anything else, the point is that using the /e modifier with s/// you can use any piece of code that works for you as the replacement of the substitution Marco Antonio Valenzuela Escárcega On Mon, 2002-07-08 at 20:14, David Carpenter wrote: > Thanks to all those who responded to my original post. I posted the > clarifcation below as a reply to the original thread, but I think it was > lost in the shuffle. > > I think I failed to make something clear. What I need is to selectively > replace only > certain characters when they appear in a string within brackets. I don't > need to transform the string as a whole. So if I > have: > > Don't Match the capital M unless {the M is inside brackets} then Match it > > I need to be able to change the M inside the brackets in such a way that the > entire line is output, but with, in this case, the single change that the > one M within the brackets has been changed to another character, say an X, > so that the line would now read: > > Don't Match the capital M unless {the X is inside brackets} then Match it > > I need to process a very large file (c. 20MB) in this way, and there are > about a dozen > different single characters what would have to be systematically changed to > an alternative character. Actually, what I want to do is change the M, for > instance, to the Unicode character U+1E43. I've been able to apply these > changes to the file as a whole, but don't know how to apply them only to > certain characters that appear in text within brackets. > > I was assuming (wrongly?) that I would have to set up some kind of loop to > run through each string within brackets to test for the M (and a number of > other characters) and change it to the U+1E43 (an a number of other Unicode > characters) if found. Can I do all this just using regular expressions with > s/// or tr///? > > I hope this is more clear. Thanks again to everyone who has offered help.. > I'm learning a lot about regular expressions! (or at least I'm trying to!) > > David > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]