• Login
Community
  • Login

replacing complexity

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
6 Posts 3 Posters 1.4k 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.
  • M
    Matt Whitlock
    last edited by May 16, 2021, 6:40 PM

    Hi I am really enjoying this forum and I am learning a lot just from reading other’s posts I have another help request as I often don’t even know how to phrase what it is I am looking to get help for.

    I would really like to be able to turn this:

    <harvestcraft:agaveitem>
    <harvestcraft:agaveseeditem>
    <harvestcraft:amaranthitem>
    <harvestcraft:amaranthseeditem>
    <harvestcraft:arrowrootitem>
    <harvestcraft:arrowrootseeditem>
    <harvestcraft:artichokeitem>
    <harvestcraft:artichokeseeditem>
    <harvestcraft:asparagusitem>
    <harvestcraft:asparagusseeditem>
    

    Into this:

    RecipeBuilder.get("farmer")
      .setShapeless([<harvestcraft:agaveitem>])
      .setFluid(<liquid:water> * 100)
      .addTool(<ore:artisansCuttingBoard>, 1)
      .addOutput(<harvestcraft:agaveseeditem>)
      .create();
    RecipeBuilder.get("farmer")
      .setShapeless([<harvestcraft:amaranthitem>])
      .setFluid(<liquid:water> * 100)
      .addTool(<ore:artisansCuttingBoard>, 1)
      .addOutput(<harvestcraft:amaranthseeditem>)
      .create();
    RecipeBuilder.get("farmer")
      .setShapeless([<harvestcraft:arrowrootitem>])
      .setFluid(<liquid:water> * 100)
      .addTool(<ore:artisansCuttingBoard>, 1)
      .addOutput(<harvestcraft:arrowrootseeditem>)
      .create();
    RecipeBuilder.get("farmer")
      .setShapeless([<harvestcraft:artichokeitem>])
      .setFluid(<liquid:water> * 100)
      .addTool(<ore:artisansCuttingBoard>, 1)
      .addOutput(<harvestcraft:artichokeseeditem>)
      .create();
    RecipeBuilder.get("farmer")
      .setShapeless([<harvestcraft:asparagusitem>])
      .setFluid(<liquid:water> * 100)
      .addTool(<ore:artisansCuttingBoard>, 1)
      .addOutput(<harvestcraft:asparagusseeditem>)
      .create();
    

    I appreciate any help anyone might have. I considered trying to do it manually but I have a few hundred I would need to do and my luck I would miss a single line and be error hunting for hours. Thanks !

    A 1 Reply Last reply May 16, 2021, 7:43 PM Reply Quote 0
    • A
      astrosofista @Matt Whitlock
      last edited by May 16, 2021, 7:43 PM

      @Matt-Whitlock

      Try the following search and replace regex:

      Search: (?-s)<((\w+:)(\w+)(item))>
      Replace: RecipeBuilder.get\("farmer"\)\r\n  .setShapeless\([<$1>]\)\r\n  .setFluid\(<liquid:water> * 100\)\r\n  .addTool\(<ore:artisansCuttingBoard>, 1\)\r\n  .addOutput\(<$2$3seed$4>\)\r\n  .create\(\);
      

      Put the caret at the very beginning of the document, select the Regular Expression mode and click on Replace All. No other option is needed.

      Have fun!

      M 1 Reply Last reply May 16, 2021, 7:46 PM Reply Quote 1
      • M
        Matt Whitlock @astrosofista
        last edited by May 16, 2021, 7:46 PM

        @astrosofista said in replacing complexity:

        RecipeBuilder.get(“farmer”)\r\n .setShapeless([<$1>])\r\n .setFluid(liquid:water * 100)\r\n .addTool(ore:artisansCuttingBoard, 1)\r\n .addOutput(<$2$3seed$4>)\r\n .create();

        A gentleman and a scholar. You just saved me likely a full day’s worth of work to do this manually. Thanks so much friend! This worked perfectly.

        A 1 Reply Last reply May 16, 2021, 8:15 PM Reply Quote 1
        • A
          Alan Kilborn @Matt Whitlock
          last edited by May 16, 2021, 8:15 PM

          @Matt-Whitlock said in replacing complexity:

          You just saved me likely a full day’s worth of work to do this manually. Thanks so much friend! This worked perfectly.

          Repay the forum by putting some effort into learning how @astrosofista did this for you. The forum won’t keep solving your problems for you forever if you don’t; in fact, after a few freebies we expect you to present what YOU’VE tried to solve your problem, before providing help. In case you don’t know where to start, the FAQ on this site has an entry concerning regular expressions.

          M 1 Reply Last reply May 16, 2021, 8:21 PM Reply Quote 0
          • M
            Matt Whitlock @Alan Kilborn
            last edited by May 16, 2021, 8:21 PM

            @Alan-Kilborn

            I am only slightly java literate and this code here I am using is called zenscript which I am … “okay” with. Is there any place you would recommend to learn more about how to use notepad++? I am finding that this program pulls more surprises out by the day.

            A 1 Reply Last reply May 16, 2021, 8:46 PM Reply Quote 0
            • A
              Alan Kilborn @Matt Whitlock
              last edited by May 16, 2021, 8:46 PM

              @Matt-Whitlock said in replacing complexity:

              Is there any place you would recommend to learn more about how to use notepad++?

              I can’t offer much truly on this. Experimentation is often the best teacher. Use it!

              But the things you have asked about in your posts aren’t really Notepad++ things, they are “regular expression” data manipulation things. Regular expressions aren’t a Notepad++ concept, but rather a general concept. And I already told you to check the FAQ about learning more about that.

              For Notepad++ in general, reading this forum is a great place.
              The user manual found HERE is also good, although it, like most manuals, is a reference, not a “how to”.

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