[EMAIL PROTECTED] wrote:
> OK. Now I can do "simple" replacement on a Unicode string
> read from a file. For example, if "Test" (T\x00e\x00s\x00t\x00")
> is in the file then I can replace it with "TEST".
Though you probably want to replace it with "T\x00E\x00S\x00T\x00" instead.
> What if I have "Test\=0\;" and I want to replace the
> numeric part with a different number? Normally I would do
> something like:
> s/Test\\=([0-9]+)\\;/Test\=Number\;/;
> Which would replace the numeric portion with "Number". If I
> simple try to expand each side of the substitution into UTF16
> it does not work.
Are the backslashes there in the file? And do you want them to be in the
result? Then you probably want something like this (untested):
s{
T\x00e\x00s\x00t\x00 # Test
\\\x00=\x00 # \ =
( # capture to $1
(?: # group
[0-9]\x00 # digit, followed by \x00
)+ # one or more of "[0-9]\x00"
) # end capturing to $1
\\\x00;\x00 # \ ;
}{
join '',
map "$_\x00",
split //,
'Test\\=Number\\;' # add "\x00" between every character
}ex;
Cheers,
Philip
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]