Microsoft KB Archive/43743

From BetaArchive Wiki
Knowledge Base

Cannot Search and Replace String Longer Than 39 Characters

Article ID: 43743

Article Last Modified on 11/21/2006


  • Microsoft QuickBasic 4.0, when used with:
    • Microsoft MS-DOS 6.22 Standard Edition
  • Microsoft QuickBASIC 4.0b, when used with:
    • Microsoft MS-DOS 6.22 Standard Edition
  • Microsoft QuickBasic 4.5 for MS-DOS, when used with:
    • Microsoft MS-DOS 6.22 Standard Edition

This article was previously published under Q43743


In the QB.EXE environment in Microsoft QuickBasic Version 4.50, searching for and replacing a string does not work correctly if the replacement string is longer than 39 characters. A longer replacement string can be entered, but the editor truncates this string to 39 characters.


Microsoft has confirmed this to be a bug in QuickBasic Version 4.50. We are researching this problem and will post new information here as it becomes available.

This problem does not occur in the QBX.EXE editor provided with Microsoft Basic Professional Development System (PDS) Version 7.00.

QuickBasic Versions 2.00 and 3.00 correctly make the substitution for strings longer than 39 characters. QuickBasic Versions 4.00 and 4.00b do not allow a string longer than 39 characters to be entered as the replacement string, so the problem doesn't occur in these versions.


To duplicate this problem, do the following:

  1. Start a new program in QB.EXE from QuickBasic 4.50 and enter the following line:


  2. Choose the Search menu by pressing ALT+S, then press C.
  3. Enter PRINT as the string to find and aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234567890 as the replacement string (39 a's, followed by numbers).
  4. Choose Change All by pressing ALT+C.

The editor will replace PRINT with the given string, but it will truncate the numbers off of the end.

Additional query words: QuickBas buglist4.50

Keywords: KB43743