Search

Script hangs after replacing a lot of regexp's in a very large string by sba

Active

2
0
Sign in
to vote
Type: Bug
ID: 779443
Opened: 2/18/2013 8:14:07 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
I wrote a script to "clean up" data from an application logfile that contains Unicode characters in the middle of an ASCII string.

The logic is as follows:

    while ($str -match '(.*)(Wstring={[^}]*\000[^}]*})(.*)')
    {
        $str = $matches[1] + ($matches[2] -replace '\000', '') + $matches[3]
    }

On a particular file, the script hangs (and the PowerShell host consumes CPU).
Details (expand)
How often does this happen?
Always Happens

Have you seen this problem before in this product?

I don't know if this issue existed previously
Reproduction Steps
Run the attached script (with the attached data input file in the same directory).
Expected Results
The script should not hang.

P.S. a workaround would be appreciated!
File Attachments
File Name Submitted By Submitted On File Size  
hangs_inputdata.xml (restricted) 2/18/2013 -
Sign in to post a comment.
Sign in to post a workaround.