6,675585
Grand MasterGrand Master
6,675585

    Dec 08, 2006#16

    This is the last time I write here an answer because it looks like you are too lazy to read help and try to understand the macro and the regular expression search string.

    ^.*FirstName= means find anything from start of a line to string "FirstName=" and so it does not matter what is in the line before FirstName=.

    I'm pretty sure you have not tried the macro with my new search string, because it is working even on ASCII escaped Unicode files with bad double BOM.

    Here is again the whole macro which converts the whole file to ASCII before the replace is executed.

    InsertMode
    ColumnModeOff
    HexOff
    UnixReOn
    SelectAll
    Copy
    NewFile
    ASCIIToUnicode
    UnixMacToDos
    Paste
    UnicodeToASCII
    Top
    Find RegExp "^.*FirstName=(.*),.*LastName=(.*),.*Address=(.*),.*$"
    Replace All "\1 \2 \3"
    Top

    With an ASCII escaped Unicode file with 2 FF FE at top of the source file always the first character in the first line of the file and the BOM is deleted by the replace too, which is also a bug of UltraEdit.

    It looks like ^.* has a bad bug at top of a Unicode file because of the hidden BOM which is not part of any line. The problem with the BOM is that it is at top of the file but for all editing operations a virtual top 2 bytes below real file top must be used if a BOM exists. And that virtual top handling is currently not perfect in UltraEdit v12.20a+4.

    Because of this BOM handling there are some problems with find/replace/sort operations on Unicode files. So I don't use Unicode files if I'm not really forced to use it because of characters available only in Unicode.

    A simple workaround to avoid problems caused by the BOM is to insert at (virtual) top of a Unicode file a line termination. So the Unicode file starts always with a blank line. That solves many macro problems with Unicode files. The inserted line can be deleted at the end of the macro.

    Here is your macro which does not convert the file to ASCII and so contains additional macro commands as workarounds for the Unicode problems of UltraEdit.

    InsertMode
    ColumnModeOff
    HexOff
    UnixReOn
    SelectAll
    Copy
    NewFile
    ASCIIToUnicode
    UnixMacToDos
    Paste
    HexOn
    Top
    Find "FFFEFFFE"
    Replace "FFFE"
    HexOff

    Bottom
    IfColNumGt 1
    "
    "
    EndIf
    Top
    "
    "
    Find RegExp "^.*FirstName=(.*),.*LastName=(.*),.*Address=(.*),.*$"
    Replace All "\1 \2 \3"
    Top
    DeleteLine

    The grayed code part is not necessary anymore because of ^.* in the regular expression string.

    By the way: Have you checked why the string in clipboard is an ASCII escaped Unicode string when you copy it from browser to the Windows clipboard? That's not default here in Europe!
    Best regards from an UC/UE/UES for Windows user from Austria

    11
    Basic UserBasic User
    11

      Dec 09, 2006#17

      thx Mofi for the help. Im not lazy, but everyone refer to you as to expert for making Macros. I think such questions for you looks very easy, but its not so for amateur.
      Anyway, I tried everything what you said and I have no intention in mind to use your knowelege to do my task, but I just try to learn UE as much as I can.
      So once again, thx for the tip. I will try to figure out everything from this point myself. The topic can be closed.

      P.S. Forgot to answer you about unicode problem. I checked options what you said to me to chec, but seems its normal.
      As I said, I did not changed original UE configuration. just installed UE and use it as is. Its an enigma for me why clipboarded txt got 'corrupted'.
      No clue what else to check to find the problem :)

      Read more posts (-13 remaining)