skip to Main Content

I have a yaml file and I have to change some letters to uppercase.

F.e. here I want to change only the words after "value:"

As is:

field_map:
      assess_1:
        type: column
        value: assess_1
      assess_10:
        type: column
        value: assess_10

As to be:

field_map:
      assess_1:
        type: column
        value: "ASSESS_1"
      assess_10:
        type: column
        value: "ASSESS_10"

2

Answers


  1. You can use ‘U’ before substitution.

    You can match with value: (S+) and Substitute with value: U$1

    Usage with your given text

    Explanation

    value: (S+) – matches value: followed by a word and consider the word as group 1
    value: U$1 – replaces the match with leaving value: as is and converting the matched group 1 to upper case

    Login or Signup to reply.
  2. you can do it with Multi Cursor:

    • select value: (also the space after the :)
    • use Selection > Select All Occurrences
    • RightArrow : you are at the start of what you want to uppercase
    • Shift+End : select till end of line
    • " : enclose selected in "
    • use command: Transform to Uppercase
    • Esc : exit Multi Cursor
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search