Javascript extract value inside parentheses between commas (Increase element's transform function arguments)How do I extract text that lies between parentheses (round brackets)?Set a default parameter value for a JavaScript functionWhat is the difference between a function expression vs declaration in JavaScript?JavaScript variable number of arguments to functionPassing arguments forward to another javascript functionDefault argument values in JavaScript functionsExtract -webkit-transform matrix3d valuesRegex 2 searches in 1 regexRegular Expression to get a string between parentheses in JavascriptSearching for code inside function using Javascript

Non-trope happy ending?

How to convince somebody that he is fit for something else, but not this job?

Why do ¬, ∀ and ∃ have the same precedence?

Why is it that I can sometimes guess the next note?

How much of a Devil Fruit must be consumed to gain the power?

How does electrical safety system work on ISS?

Why does AES have exactly 10 rounds for a 128-bit key, 12 for 192 bits and 14 for a 256-bit key size?

Change the color of a single dot in `ddot` symbol

The Digit Triangles

Quoting Keynes in a lecture

Does grappling negate Mirror Image?

Creating two special characters

Stack Interview Code methods made from class Node and Smart Pointers

I found an audio circuit and I built it just fine, but I find it a bit too quiet. How do I amplify the output so that it is a bit louder?

How to draw a matrix with arrows in limited space

A variation to the phrase "hanging over my shoulders"

A Trivial Diagnosis

awk assign to multiple variables at once

What is Cash Advance APR?

Delete multiple columns using awk or sed

Did the UK lift the requirement for registering SIM cards?

What is going on with gets(stdin) on the site coderbyte?

Mimic lecturing on blackboard, facing audience

How would you translate "more" for use as an interface button?



Javascript extract value inside parentheses between commas (Increase element's transform function arguments)


How do I extract text that lies between parentheses (round brackets)?Set a default parameter value for a JavaScript functionWhat is the difference between a function expression vs declaration in JavaScript?JavaScript variable number of arguments to functionPassing arguments forward to another javascript functionDefault argument values in JavaScript functionsExtract -webkit-transform matrix3d valuesRegex 2 searches in 1 regexRegular Expression to get a string between parentheses in JavascriptSearching for code inside function using Javascript













1















The context here is simple, I want to capture the transform css value from a graphic element and increase it by 10.



In my case the only transform I have is translate, but ideally it would work if there are other ones as well as I only want to change the translate value.



I tagged it as regex but not sure if it's needed.






const myElement = document.getElementById('myElement');
const translateString = myElement.getAttribute('transform');
const newTranslateString = increaseArgumentsBy10(translateString);
myElement.setAttribute('transform', newTranslateString);


function increaseArgumentsBy10(translateString)
console.log('To be implemented');
return translateString;

<svg>
<text id="myElement" transform="translate(50,50)">My Element
</text>
</svg>












share|improve this question


























    1















    The context here is simple, I want to capture the transform css value from a graphic element and increase it by 10.



    In my case the only transform I have is translate, but ideally it would work if there are other ones as well as I only want to change the translate value.



    I tagged it as regex but not sure if it's needed.






    const myElement = document.getElementById('myElement');
    const translateString = myElement.getAttribute('transform');
    const newTranslateString = increaseArgumentsBy10(translateString);
    myElement.setAttribute('transform', newTranslateString);


    function increaseArgumentsBy10(translateString)
    console.log('To be implemented');
    return translateString;

    <svg>
    <text id="myElement" transform="translate(50,50)">My Element
    </text>
    </svg>












    share|improve this question
























      1












      1








      1








      The context here is simple, I want to capture the transform css value from a graphic element and increase it by 10.



      In my case the only transform I have is translate, but ideally it would work if there are other ones as well as I only want to change the translate value.



      I tagged it as regex but not sure if it's needed.






      const myElement = document.getElementById('myElement');
      const translateString = myElement.getAttribute('transform');
      const newTranslateString = increaseArgumentsBy10(translateString);
      myElement.setAttribute('transform', newTranslateString);


      function increaseArgumentsBy10(translateString)
      console.log('To be implemented');
      return translateString;

      <svg>
      <text id="myElement" transform="translate(50,50)">My Element
      </text>
      </svg>












      share|improve this question














      The context here is simple, I want to capture the transform css value from a graphic element and increase it by 10.



      In my case the only transform I have is translate, but ideally it would work if there are other ones as well as I only want to change the translate value.



      I tagged it as regex but not sure if it's needed.






      const myElement = document.getElementById('myElement');
      const translateString = myElement.getAttribute('transform');
      const newTranslateString = increaseArgumentsBy10(translateString);
      myElement.setAttribute('transform', newTranslateString);


      function increaseArgumentsBy10(translateString)
      console.log('To be implemented');
      return translateString;

      <svg>
      <text id="myElement" transform="translate(50,50)">My Element
      </text>
      </svg>








      const myElement = document.getElementById('myElement');
      const translateString = myElement.getAttribute('transform');
      const newTranslateString = increaseArgumentsBy10(translateString);
      myElement.setAttribute('transform', newTranslateString);


      function increaseArgumentsBy10(translateString)
      console.log('To be implemented');
      return translateString;

      <svg>
      <text id="myElement" transform="translate(50,50)">My Element
      </text>
      </svg>





      const myElement = document.getElementById('myElement');
      const translateString = myElement.getAttribute('transform');
      const newTranslateString = increaseArgumentsBy10(translateString);
      myElement.setAttribute('transform', newTranslateString);


      function increaseArgumentsBy10(translateString)
      console.log('To be implemented');
      return translateString;

      <svg>
      <text id="myElement" transform="translate(50,50)">My Element
      </text>
      </svg>






      javascript regex






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 12 hours ago









      MojimiMojimi

      4051033




      4051033






















          1 Answer
          1






          active

          oldest

          votes


















          1














          you can create a function translate and use eval






          const myElement = document.getElementById('myElement');
          const translateString = myElement.getAttribute('transform');
          const newTranslateString = increaseArgumentsBy10(translateString);
          myElement.setAttribute('transform', newTranslateString);


          function increaseArgumentsBy10(translateString)
          function translate(x, y)
          return('translate(' + (x + 10) + ', ' + (y + 10) + ')');

          return eval(translateString);

          <svg>
          <text id="myElement" transform="translate(50,50)">My Element
          </text>
          </svg>








          share|improve this answer























          • That's very, very clever but seems illegal

            – Mojimi
            11 hours ago











          • @Mojimi you have to use try cacth(e) and it would be totaly legal ;-)

            – tomboul
            9 hours ago










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280170%2fjavascript-extract-value-inside-parentheses-between-commas-increase-elements-t%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          you can create a function translate and use eval






          const myElement = document.getElementById('myElement');
          const translateString = myElement.getAttribute('transform');
          const newTranslateString = increaseArgumentsBy10(translateString);
          myElement.setAttribute('transform', newTranslateString);


          function increaseArgumentsBy10(translateString)
          function translate(x, y)
          return('translate(' + (x + 10) + ', ' + (y + 10) + ')');

          return eval(translateString);

          <svg>
          <text id="myElement" transform="translate(50,50)">My Element
          </text>
          </svg>








          share|improve this answer























          • That's very, very clever but seems illegal

            – Mojimi
            11 hours ago











          • @Mojimi you have to use try cacth(e) and it would be totaly legal ;-)

            – tomboul
            9 hours ago















          1














          you can create a function translate and use eval






          const myElement = document.getElementById('myElement');
          const translateString = myElement.getAttribute('transform');
          const newTranslateString = increaseArgumentsBy10(translateString);
          myElement.setAttribute('transform', newTranslateString);


          function increaseArgumentsBy10(translateString)
          function translate(x, y)
          return('translate(' + (x + 10) + ', ' + (y + 10) + ')');

          return eval(translateString);

          <svg>
          <text id="myElement" transform="translate(50,50)">My Element
          </text>
          </svg>








          share|improve this answer























          • That's very, very clever but seems illegal

            – Mojimi
            11 hours ago











          • @Mojimi you have to use try cacth(e) and it would be totaly legal ;-)

            – tomboul
            9 hours ago













          1












          1








          1







          you can create a function translate and use eval






          const myElement = document.getElementById('myElement');
          const translateString = myElement.getAttribute('transform');
          const newTranslateString = increaseArgumentsBy10(translateString);
          myElement.setAttribute('transform', newTranslateString);


          function increaseArgumentsBy10(translateString)
          function translate(x, y)
          return('translate(' + (x + 10) + ', ' + (y + 10) + ')');

          return eval(translateString);

          <svg>
          <text id="myElement" transform="translate(50,50)">My Element
          </text>
          </svg>








          share|improve this answer













          you can create a function translate and use eval






          const myElement = document.getElementById('myElement');
          const translateString = myElement.getAttribute('transform');
          const newTranslateString = increaseArgumentsBy10(translateString);
          myElement.setAttribute('transform', newTranslateString);


          function increaseArgumentsBy10(translateString)
          function translate(x, y)
          return('translate(' + (x + 10) + ', ' + (y + 10) + ')');

          return eval(translateString);

          <svg>
          <text id="myElement" transform="translate(50,50)">My Element
          </text>
          </svg>








          const myElement = document.getElementById('myElement');
          const translateString = myElement.getAttribute('transform');
          const newTranslateString = increaseArgumentsBy10(translateString);
          myElement.setAttribute('transform', newTranslateString);


          function increaseArgumentsBy10(translateString)
          function translate(x, y)
          return('translate(' + (x + 10) + ', ' + (y + 10) + ')');

          return eval(translateString);

          <svg>
          <text id="myElement" transform="translate(50,50)">My Element
          </text>
          </svg>





          const myElement = document.getElementById('myElement');
          const translateString = myElement.getAttribute('transform');
          const newTranslateString = increaseArgumentsBy10(translateString);
          myElement.setAttribute('transform', newTranslateString);


          function increaseArgumentsBy10(translateString)
          function translate(x, y)
          return('translate(' + (x + 10) + ', ' + (y + 10) + ')');

          return eval(translateString);

          <svg>
          <text id="myElement" transform="translate(50,50)">My Element
          </text>
          </svg>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 12 hours ago









          tomboultomboul

          6615




          6615












          • That's very, very clever but seems illegal

            – Mojimi
            11 hours ago











          • @Mojimi you have to use try cacth(e) and it would be totaly legal ;-)

            – tomboul
            9 hours ago

















          • That's very, very clever but seems illegal

            – Mojimi
            11 hours ago











          • @Mojimi you have to use try cacth(e) and it would be totaly legal ;-)

            – tomboul
            9 hours ago
















          That's very, very clever but seems illegal

          – Mojimi
          11 hours ago





          That's very, very clever but seems illegal

          – Mojimi
          11 hours ago













          @Mojimi you have to use try cacth(e) and it would be totaly legal ;-)

          – tomboul
          9 hours ago





          @Mojimi you have to use try cacth(e) and it would be totaly legal ;-)

          – tomboul
          9 hours ago



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55280170%2fjavascript-extract-value-inside-parentheses-between-commas-increase-elements-t%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해