• Login
Community
  • Login

Replace only this first lines of world (i need maybe a plugin?)

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
3 Posts 2 Posters 476 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.
  • F
    fanelise1
    last edited by Feb 26, 2019, 5:25 PM

    Hello guys…
    im here with a little problem…
    i have a document and i have in document something like…

    test1,test2,test3
    test4,test5,test6

    etc…
    on every line are 2 “,” right?
    i wanted to replace only the first , on every line… the second , need to be ,

    Is any tips or plugin who can help me to solve this problem? maybe a plugin to select a world and to make a tab of them or something like this where i can replace with what i want?

    1 Reply Last reply Reply Quote 0
    • P
      PeterJones
      last edited by Feb 26, 2019, 5:45 PM

      @fanelise1, Welcome to the Community,

      You didn’t say what you wanted to replace it with. But it’s pretty easy to do with regular expressions.

      Your FindWhat should be ,(.*)$: this says find a comma, then store the rest of the line in group $1 (aka \1). Your replacement would then be ::$1 if you wanted to replace that first comma with ::; the literal characters are replaced as-is, and the $1 brings back the group1, which was the rest of the line from the original match.

      With your example data

      test1,test2,test3
      test4,test5,test6
      

      that results in

      test1::test2,test3
      test4::test5,test6
      

      -----
      Some boilerplate that I usually add the first time I respond to a new user’s search/replace question:

      This forum is formatted using Markdown , with a help link buried on the little grey ? in the COMPOSE window/pane when writing your post. For more about how to use Markdown in this forum, please see @Scott-Sumner’s post in the “how to markdown code on this forum” topic , and my updates near the end . It is very important that you use these formatting tips – using single backtick marks around small snippets, and using code-quoting for pasting multiple lines from your example data files – because otherwise, the forum will change normal quotes ("") to curly “smart” quotes (“”), will change hyphens to dashes, will sometimes hide asterisks (or if your text is c:\folder\*.txt, it will show up as c:\folder*.txt, missing the backslash). If you want to clearly communicate your text data to us, you need to properly format it.

      If you have further search-and-replace (“matching”, “marking”, “bookmarking”, regular expression, “regex”) needs, study this FAQ and the documentation it points to. Before asking a new regex question, understand that for future requests, many of us will expect you to show what data you have (exactly), what data you want (exactly), what regex you already tried (to show that you’re showing effort), why you thought that regex would work (to prove it wasn’t just something randomly typed), and what data you’re getting with an explanation of why that result is wrong. When you show that effort, you’ll see us bend over backward to get things working for you. If you need help formatting, see the paragraph above.

      Please note that for all regex and related queries, it is best if you are explicit about what needs to match, and what shouldn’t match, and have multiple examples of both in your example dataset. Often, what shouldn’t match helps define the regular expression as much or more than what should match.

      1 Reply Last reply Reply Quote 4
      • F
        fanelise1
        last edited by Feb 26, 2019, 6:42 PM

        thanks sir. god bless you!

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