Community
    • Login

    Add A Word in Between A Phrase And A List of Values

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 499 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.
    • ZaneChiwawaUTAUZ
      ZaneChiwawaUTAU
      last edited by

      Could you please help me with the following search-and-replace problem I am having?

      I want to enter a word at the end of each alias for the name of a sound file. This time I want to enter the word “強.” An alias is a phrase that is used to represent the name of special parameter values that is set for a sound file name. The aliases are represented as a word or phrase after an “=” sign. The numbers represent the values for each parameter.

      Here is the data I currently have (“before” data):

      _uuioaoi.wav=i_hh,4219,340,0,154,80
      _uuioaoi.wav=ihh,4147,360,0,240,80
      a2.wav=あ↑,78,251,298,0,0
      

      Here is how I would like that data to look (“after” data):

      _uuioaoi.wav=i_hh強,4219,340,0,154,80
      _uuioaoi.wav=ihh強,4147,360,0,240,80
      a2.wav=あ↑強,78,251,298,0,0
      

      I’m not experienced with using an app like this. This was the app a friend recommended to me to work on files that function like this. If I can be led in the right direction on what to do, that would help a lot. Thank you.

      PeterJonesP 1 Reply Last reply Reply Quote 1
      • PeterJonesP
        PeterJones @ZaneChiwawaUTAU
        last edited by

        @ZaneChiwawaUTAU ,

        Thank you for showing before and after data in the code blocks.

        You have to use a feature called “regular expressions”.

        In your instance, it looks like you want to put your character right before the first comma in each line.

        • FIND WHAT = ^([^\r\n,]*),
        • REPLACE WITH = $1強,
        • SEARCH MODE = Regular Expression

        The FIND of the regular expression will look for the beginning of the line (^), followed by 0-or-more (*) of the characters that aren’t CR, LF, or comma ([^\r\n,]), followed by a comma. Everying inside the (...) parentheses will go into group#1 for storage

        The REPLACE starts with the contents of group#1 ($1), which will be the first field of your line, followed by the literal text 強, followed by a literal comma.

        This is just one of the multitudes of things you can do with Regular Expressions. Look up each of the tokens I shared in the online User Manua’s Searching/Regex section linked below, to learn more about what they do, and to see other similar things that can be done.

        Useful References

        • Notepad++ Online User Manual: Searching/Regex
        • FAQ: Where to find other regular expressions (regex) documentation
        1 Reply Last reply Reply Quote 2
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors