Community
    • Login

    quick one...

    Scheduled Pinned Locked Moved General Discussion
    7 Posts 3 Posters 271 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • X
      x-77-x
      last edited by x-77-x

      im trying to change (in multiple files)

      NAME=there is Multiple Words here
      NAME=taco

      to

      NAME=There Is Multiple Words Here
      NAME=Taco

      problem is, there are also DEFNAME= lines (which i dont want) and of the lines
      (i can always go back and change the of the later)

      so for search i got
      ^NAME=(.*)$

      but how do first letter capitilize the words after that? sometimes its 1 word, sometimes its 2 3 4 5 words…

      for replace i tried
      NAME=\u$1

      but that only does the first word in the string…

      how would you do every word after the NAME= part?

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @x-77-x
        last edited by PeterJones

        @x-77-x ,

        If I were trying to solve this for myself, I’d probably go to the Generic Regular Expression FAQ and try Replace in a Specific Zone of Text.

        As long as there is Multiple Words here is all on a single line (you originally said Multiple Lines, which worried me; I’m glad you changed it), then the beginning-of-region expression (the BSR term) would be ^NAME=, and you would want to search for whole words, which are \b\w+\b; the replacement would be \u$0 . You would plug those into the single-line version of the formula

        X 1 Reply Last reply Reply Quote 3
        • X
          x-77-x @PeterJones
          last edited by x-77-x

          im confused… hmmm

          i was able to bookmark all the NAME= lines with ^NAME=(.*)$

          is there a way to use the EDIT - CONVERT CASE TO on only the marked lines?

          i could always go back a second time and change the Name= back to NAME=

          PeterJonesP Terry RT 2 Replies Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @x-77-x
            last edited by

            @x-77-x said in quick one...:

            im confused… hmmm

            I’m confused too, because the FAQ explains what to do, and when I followed the instructions in the FAQ, it transformed your example data as you requested. (yes, I had a mistake in the URL for the second, sending you to the first page again, but if you couldn’t figure out from there what to click, then you need to try again… and i’ve fixed the link)

            If the regex you derived from the formula in that Specific Zone of Text one-line formula doesn’t work, show us exactly what you tried, because it worked for me.

            1 Reply Last reply Reply Quote 0
            • Terry RT
              Terry R @x-77-x
              last edited by

              @x-77-x said in quick one...:

              i was able to bookmark

              In your first post you referred to “Replace” suggesting you were using the Replace function. In your second post you refer to “bookmark”. Why the change? The supplied solution is using the Replace function which you first referred to.

              Terry

              X 1 Reply Last reply Reply Quote 1
              • X
                x-77-x @Terry R
                last edited by x-77-x

                @Terry-R just suggesting a different route, i dont understand what peter is talking about (too advanced for me), im a Noob so all i use is…

                Find In Files/Replace
                Find what:
                Replace with:

                and thats about it

                so i thought maybe i could bookmark the lines then use the convert case instead

                PeterJonesP 1 Reply Last reply Reply Quote 0
                • PeterJonesP
                  PeterJones @x-77-x
                  last edited by PeterJones

                  @x-77-x said in quick one...:

                  i dont understand what peter is talking about

                  Sorry, given the proficiency that your original regex showed, I had hoped that you would understand my pointers.

                  The FAQ gives the following formula for replacing within a zone of text on one line – it was meant as a “fill in the blank” so that you could use the formula even if you don’t understand the syntax used:

                  SEARCH (?-s)(?-i:BSR|(?!\A)\G).*?\K(?-i:FR)
                  REPLACE RR

                  The FAQ also explained what BSR and FR meant.

                  I also told you that BSR for your case was ^NAME= and that what you wanted to match was \b\w+\b (sorry, I thought I had told you that was FR, but apparently didn’t type that part), and that your replacement should be \u$0

                  Thus, you should try SEARCH = (?-s)(?-i:^NAME=|(?!\A)\G).*?\K(?-i:\b\w+\b) and REPLACE = \u$0

                  … At least, that worked for me given your example data.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  The Community of users of the Notepad++ text editor.
                  Powered by NodeBB | Contributors