How to add "" quotes or [] to each line

How to add "" quotes or [] to each line

2
NewbieNewbie
2

    Jan 29, 2005#1

    For example:

    word1
    word2 word3
    word4
    word 5

    become:

    "word1"
    "word2 word3"
    "word4"
    "word 5"

    or

    [word1]
    [word2 word3]
    [word4]
    [word 5]



    Thanks !

    206
    MasterMaster
    206

      Jan 29, 2005#2

      Do a search and replace with the regular expression option checked. Unix mode active (see Advanced > Configuration > Find Tab to set)

      Search: ^(.+)$
      Replace: "\1"

      or

      Replace: [\1]
      Software For Metalworking
      http://closetolerancesoftware.com

      2
      NewbieNewbie
      2

        Jan 30, 2005#3

        Thank you, works fine :)

        1
        NewbieNewbie
        1

          Feb 25, 2005#4

          Great - glad someone has asked. I use UE for MapBasic, which doesn't have a block comment function.

          I tried your solution
          (Regular expressions / unix style enabled replace ^(.+)$ with '\1')

          on the following text:

          open file logfileP for append as #2 filetype "TEXT"
          write #1, "[1997 completed]"
          write #2, "[1997 completed]"
          close file #2

          But got: "Search string not found."

          I actually need single quotes, but was just testing the principle.

          What am I doing wrong, please?

          Thanks, 8O Bruce

          I am using version 7.10b, which doesn't have the EDIT - ADD COMMENT function.

          261
          Basic UserBasic User
          261

            Mar 01, 2005#5

            You might need to check Replace All is from Top of File in the Replace dialog. I got the same result when I unchecked it.

            Dave
            ASTTMan
            I'm not a Texan, I just live here.

            5
            NewbieNewbie
            5

              Mar 17, 2005#6

              Thank you for this post, mrainey56! With it I was able to add a semi-colon at the end of each line in a large file. You da man!

              6
              NewbieNewbie
              6

                Re: How to add "" quotes or [] to each line

                May 11, 2006#7

                Hey lizard,

                I was having the exact same issue you describe above. I found that by selecting the "UltraEdit style Regular Expressions" option (not the "Unix style") under Advanced -> Configuration -> Search -> Regular Expression Engine I was able to use then the Find/Replace strings specified earlier in this thread.

                I would like to know how to use the Unix Style expression for this sort of inserting of text.

                15
                Basic UserBasic User
                15

                  Re: How to add "" quotes or [] to each line

                  May 12, 2006#8

                  Whole books have been written about regular expressions. (Try O'reilly Books.) It will take a while before you get comfortable with them.

                  Note that the latest versions of UE/UES have Perl style regular expressions. They build on the Unix style, but take things to a whole new level of difficulty. :)

                  Travis

                  6
                  NewbieNewbie
                  6

                    Re: How to add "" quotes or [] to each line

                    May 18, 2006#9

                    Absolutely, deepthinker! Immediately following my post above I placed and order for "Mastering Regular Expressions, Second Edition" by Jeffrey Friedl and from O'reilly Publishing. Can't wait to crack that cover! Thanks!