Retrieve regex full matchRegex for numbers onlyHow do I return multiple values from a function?Regular expression to match a line that doesn't contain a wordHow do you access the matched groups in a JavaScript regular expression?How can I match multiple occurrences with a regex in JavaScript similar to PHP's preg_match_all()?Converting user input string to regular expressionRegEx match open tags except XHTML self-contained tagsPython progression path - From apprentice to guruRegEx to extract all matches from string using RegExp.execString split with regex, return array with full matches

Do wheelchair aircraft exist?

12TET vs Pythagorean scales; "perfect" fourths?

2000s Animated TV show where teenagers could physically go into a virtual world

Social leper versus social leopard

Examples of "unsuccessful" theories with afterlives

Is it impolite to ask for halal food when traveling to and in Thailand?

Meaning of 'ran' in German?

Co-Supervisor comes to office to help her students which distracts me

Is this Portent-like spell balanced?

Meaning of 小せェサル in the following sentence

Hiking with a mule or two?

To what extent is it worthwhile to report check fraud / refund scams?

What exactly did this mechanic sabotage on the American Airlines 737, and how dangerous was it?

Lettrine + string manipulation + some fonts = errors and weird issues

Is there any iPhone SE out there with 3D Touch?

How can an attacker use robots.txt?

What is the need of methods like GET and POST in the HTTP protocol?

Safely hang a mirror that does not have hooks

Does Sitecore have support for Sitecore products in containers?

Can a broken/split chain be reassembled?

Is it really necessary to have a four hour meeting in Sprint planning?

practicality of 30 year fix mortgage at 55 years of age

A delve into extraordinary chess problems: Selfmate 1

Should the average user with no special access rights be worried about SMS-based 2FA being theoretically interceptable?



Retrieve regex full match


Regex for numbers onlyHow do I return multiple values from a function?Regular expression to match a line that doesn't contain a wordHow do you access the matched groups in a JavaScript regular expression?How can I match multiple occurrences with a regex in JavaScript similar to PHP's preg_match_all()?Converting user input string to regular expressionRegEx match open tags except XHTML self-contained tagsPython progression path - From apprentice to guruRegEx to extract all matches from string using RegExp.execString split with regex, return array with full matches






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm new in regex expressions. I've read the documentation but I still have some questions.



I Have the following string:



[('15000042', 19)]


And I need to get the key, the comma and the value as a string.
like this:



15000042,19


I need this to enter these value as a comma separated value in a database.



I've tried the next regular expression:



([w,]+)


but this only split the string into 3 substrings. Is there a way to get the full match?



https://regex101.com/r/vtYKOG/1



I'm using python










share|improve this question






























    0















    I'm new in regex expressions. I've read the documentation but I still have some questions.



    I Have the following string:



    [('15000042', 19)]


    And I need to get the key, the comma and the value as a string.
    like this:



    15000042,19


    I need this to enter these value as a comma separated value in a database.



    I've tried the next regular expression:



    ([w,]+)


    but this only split the string into 3 substrings. Is there a way to get the full match?



    https://regex101.com/r/vtYKOG/1



    I'm using python










    share|improve this question


























      0












      0








      0








      I'm new in regex expressions. I've read the documentation but I still have some questions.



      I Have the following string:



      [('15000042', 19)]


      And I need to get the key, the comma and the value as a string.
      like this:



      15000042,19


      I need this to enter these value as a comma separated value in a database.



      I've tried the next regular expression:



      ([w,]+)


      but this only split the string into 3 substrings. Is there a way to get the full match?



      https://regex101.com/r/vtYKOG/1



      I'm using python










      share|improve this question














      I'm new in regex expressions. I've read the documentation but I still have some questions.



      I Have the following string:



      [('15000042', 19)]


      And I need to get the key, the comma and the value as a string.
      like this:



      15000042,19


      I need this to enter these value as a comma separated value in a database.



      I've tried the next regular expression:



      ([w,]+)


      but this only split the string into 3 substrings. Is there a way to get the full match?



      https://regex101.com/r/vtYKOG/1



      I'm using python







      python regex python-3.x python-3.7






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 28 at 17:01









      Javier RamirezJavier Ramirez

      521 silver badge7 bronze badges




      521 silver badge7 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          2
















          You match what you don't want to keep and use 3 groups instead of 1 and assemble your value using these 3 groups:



          [('(d+)'(,) (d+))]


          Regex demo



          For example:



          import re

          test_str = "[('15000042', 19)]"
          result = re.sub(r"[('(d+)'(,) (d+))]", r"123", test_str)

          if result:
          print (result)


          Result



          15000042,19


          Another option is to use only your character class [^w,]+ and negate it so match not what is listed.



          Then replace those characters with an empty string:



          import re

          test_str = "[('15000042', 19)]"
          result = re.sub(r"[^w,]+", "", test_str)

          if result:
          print (result)


          Regex demo






          share|improve this answer






















          • 1





            Thank you very much, I think is better the second case since it fits my needs.

            – Javier Ramirez
            Mar 28 at 17:44













          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/4.0/"u003ecc by-sa 4.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%2f55403179%2fretrieve-regex-full-match%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









          2
















          You match what you don't want to keep and use 3 groups instead of 1 and assemble your value using these 3 groups:



          [('(d+)'(,) (d+))]


          Regex demo



          For example:



          import re

          test_str = "[('15000042', 19)]"
          result = re.sub(r"[('(d+)'(,) (d+))]", r"123", test_str)

          if result:
          print (result)


          Result



          15000042,19


          Another option is to use only your character class [^w,]+ and negate it so match not what is listed.



          Then replace those characters with an empty string:



          import re

          test_str = "[('15000042', 19)]"
          result = re.sub(r"[^w,]+", "", test_str)

          if result:
          print (result)


          Regex demo






          share|improve this answer






















          • 1





            Thank you very much, I think is better the second case since it fits my needs.

            – Javier Ramirez
            Mar 28 at 17:44















          2
















          You match what you don't want to keep and use 3 groups instead of 1 and assemble your value using these 3 groups:



          [('(d+)'(,) (d+))]


          Regex demo



          For example:



          import re

          test_str = "[('15000042', 19)]"
          result = re.sub(r"[('(d+)'(,) (d+))]", r"123", test_str)

          if result:
          print (result)


          Result



          15000042,19


          Another option is to use only your character class [^w,]+ and negate it so match not what is listed.



          Then replace those characters with an empty string:



          import re

          test_str = "[('15000042', 19)]"
          result = re.sub(r"[^w,]+", "", test_str)

          if result:
          print (result)


          Regex demo






          share|improve this answer






















          • 1





            Thank you very much, I think is better the second case since it fits my needs.

            – Javier Ramirez
            Mar 28 at 17:44













          2














          2










          2









          You match what you don't want to keep and use 3 groups instead of 1 and assemble your value using these 3 groups:



          [('(d+)'(,) (d+))]


          Regex demo



          For example:



          import re

          test_str = "[('15000042', 19)]"
          result = re.sub(r"[('(d+)'(,) (d+))]", r"123", test_str)

          if result:
          print (result)


          Result



          15000042,19


          Another option is to use only your character class [^w,]+ and negate it so match not what is listed.



          Then replace those characters with an empty string:



          import re

          test_str = "[('15000042', 19)]"
          result = re.sub(r"[^w,]+", "", test_str)

          if result:
          print (result)


          Regex demo






          share|improve this answer















          You match what you don't want to keep and use 3 groups instead of 1 and assemble your value using these 3 groups:



          [('(d+)'(,) (d+))]


          Regex demo



          For example:



          import re

          test_str = "[('15000042', 19)]"
          result = re.sub(r"[('(d+)'(,) (d+))]", r"123", test_str)

          if result:
          print (result)


          Result



          15000042,19


          Another option is to use only your character class [^w,]+ and negate it so match not what is listed.



          Then replace those characters with an empty string:



          import re

          test_str = "[('15000042', 19)]"
          result = re.sub(r"[^w,]+", "", test_str)

          if result:
          print (result)


          Regex demo







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 28 at 17:36

























          answered Mar 28 at 17:27









          The fourth birdThe fourth bird

          41.1k9 gold badges20 silver badges37 bronze badges




          41.1k9 gold badges20 silver badges37 bronze badges










          • 1





            Thank you very much, I think is better the second case since it fits my needs.

            – Javier Ramirez
            Mar 28 at 17:44












          • 1





            Thank you very much, I think is better the second case since it fits my needs.

            – Javier Ramirez
            Mar 28 at 17:44







          1




          1





          Thank you very much, I think is better the second case since it fits my needs.

          – Javier Ramirez
          Mar 28 at 17:44





          Thank you very much, I think is better the second case since it fits my needs.

          – Javier Ramirez
          Mar 28 at 17:44




















          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%2f55403179%2fretrieve-regex-full-match%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

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript