How to Replace >9 TAB seperated words?

How to Replace >9 TAB seperated words?

19
Basic UserBasic User
19

    Jun 24, 2006#1

    Hi,

    I've got a list with lines of 11 different words and numbers. Each of this single line should be converted in 11 XML-lines. But with \1,\2,..,\9 I can only adress 9 of these values per line :? . What can I do to use all fields of a line with one Find-and-Replace action?

    I want: replace line:
    word1 TAB word2 TAB ..... word11

    with:
    <xml1>somthing with word1</xml1>
    <xml2>blabla word2</xml2>
    ...
    <xml11>a sentence with word11</xml11>

    I thought about this Macro:
    For Find I use: "^(.*)\t(.*)\t...\t(.*)\r\n$"

    For Replace All: "<xml1>something with \1</xml1>
    ... <xml9>now using \9</xml9>"

    6,675585
    Grand MasterGrand Master
    6,675585

      Jun 25, 2006#2

      Use 3 instead of only 1 replace all.

      1) Convert the first 9 words:

      Find RegExp "^(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t"
      Replace All "<xml1>\1</xml1><xml2>\2</xml2><xml3>\3</xml3><xml4>\4</xml4><xml5>\5</xml5><xml6>\6</xml6><xml7>\7</xml7><xml8>\8</xml8><xml9>\9</xml9>\t"


      2) Convert the last 2 words:

      Find RegExp "^(.*)\t(.*)\t(.*)$"
      Replace All "\1<xml10>\2</xml10><xml11>\3</xml11>"


      3) Break the long lines into multiple lines:

      Find RegExp "(</xml\d*>)<"
      Replace All "\1\p<"


      It looks like your source file is a CSV file. Maybe you should also look at Column - Convert to Fixed Column and insert the strings you want in column mode after conversion. 2 final regex replace all to remove the unneeded spaces and to break up the long lines finishes the conversion.
      Best regards from an UC/UE/UES for Windows user from Austria