Regex to match user and user@domain












2















A user can login as "user" or as "user@domain". I only want to extract "user" in both cases. I am looking for a matcher expression to fit it, but im struggling.



final Pattern userIdPattern = Pattern.compile("(.*)[@]{0,1}.*");
final Matcher fieldMatcher = userIdPattern.matcher("user@test");
final String userId = fieldMatcher.group(1)


userId returns "user@test". I tried various expressions but it seems that nothing fits my requirement :-(



Any ideas?










share|improve this question























  • You must have if (fieldMatcher.find()) there, too, right? Try String userId = s.replaceFirst("^([^@]+).*", "$1");

    – Wiktor Stribiżew
    Nov 20 '18 at 19:50













  • (.*)@?.* maybe?

    – daniu
    Nov 20 '18 at 19:54








  • 1





    yourString.split("@")[0]

    – GriffeyDog
    Nov 20 '18 at 20:18
















2















A user can login as "user" or as "user@domain". I only want to extract "user" in both cases. I am looking for a matcher expression to fit it, but im struggling.



final Pattern userIdPattern = Pattern.compile("(.*)[@]{0,1}.*");
final Matcher fieldMatcher = userIdPattern.matcher("user@test");
final String userId = fieldMatcher.group(1)


userId returns "user@test". I tried various expressions but it seems that nothing fits my requirement :-(



Any ideas?










share|improve this question























  • You must have if (fieldMatcher.find()) there, too, right? Try String userId = s.replaceFirst("^([^@]+).*", "$1");

    – Wiktor Stribiżew
    Nov 20 '18 at 19:50













  • (.*)@?.* maybe?

    – daniu
    Nov 20 '18 at 19:54








  • 1





    yourString.split("@")[0]

    – GriffeyDog
    Nov 20 '18 at 20:18














2












2








2








A user can login as "user" or as "user@domain". I only want to extract "user" in both cases. I am looking for a matcher expression to fit it, but im struggling.



final Pattern userIdPattern = Pattern.compile("(.*)[@]{0,1}.*");
final Matcher fieldMatcher = userIdPattern.matcher("user@test");
final String userId = fieldMatcher.group(1)


userId returns "user@test". I tried various expressions but it seems that nothing fits my requirement :-(



Any ideas?










share|improve this question














A user can login as "user" or as "user@domain". I only want to extract "user" in both cases. I am looking for a matcher expression to fit it, but im struggling.



final Pattern userIdPattern = Pattern.compile("(.*)[@]{0,1}.*");
final Matcher fieldMatcher = userIdPattern.matcher("user@test");
final String userId = fieldMatcher.group(1)


userId returns "user@test". I tried various expressions but it seems that nothing fits my requirement :-(



Any ideas?







java regex






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 19:49









HenfoHenfo

313




313













  • You must have if (fieldMatcher.find()) there, too, right? Try String userId = s.replaceFirst("^([^@]+).*", "$1");

    – Wiktor Stribiżew
    Nov 20 '18 at 19:50













  • (.*)@?.* maybe?

    – daniu
    Nov 20 '18 at 19:54








  • 1





    yourString.split("@")[0]

    – GriffeyDog
    Nov 20 '18 at 20:18



















  • You must have if (fieldMatcher.find()) there, too, right? Try String userId = s.replaceFirst("^([^@]+).*", "$1");

    – Wiktor Stribiżew
    Nov 20 '18 at 19:50













  • (.*)@?.* maybe?

    – daniu
    Nov 20 '18 at 19:54








  • 1





    yourString.split("@")[0]

    – GriffeyDog
    Nov 20 '18 at 20:18

















You must have if (fieldMatcher.find()) there, too, right? Try String userId = s.replaceFirst("^([^@]+).*", "$1");

– Wiktor Stribiżew
Nov 20 '18 at 19:50







You must have if (fieldMatcher.find()) there, too, right? Try String userId = s.replaceFirst("^([^@]+).*", "$1");

– Wiktor Stribiżew
Nov 20 '18 at 19:50















(.*)@?.* maybe?

– daniu
Nov 20 '18 at 19:54







(.*)@?.* maybe?

– daniu
Nov 20 '18 at 19:54






1




1





yourString.split("@")[0]

– GriffeyDog
Nov 20 '18 at 20:18





yourString.split("@")[0]

– GriffeyDog
Nov 20 '18 at 20:18












4 Answers
4






active

oldest

votes


















2














If you use "(.*)[@]{0,1}.*" pattern with .matches(), the (.*) grabs the whole line first, then, when the regex index is still at the end of the line, the [@]{0,1} pattern triggers and matches at the end of the line because it can match 0 @ chars, and then .* again matches at that very location as it matches any 0+ chars. Thus, the whole line lands in your Group 1.



You may use



String userId = s.replaceFirst("^([^@]+).*", "$1");


See the regex demo.



Details





  • ^ - start of string


  • ([^@]+) - Group 1 (referred to with $1 from the replacement pattern): any 1+ chars other than @


  • .* - the rest of the string.






share|improve this answer
























  • Thanks, this answered my question. An admin is allowed to edit matching patterns to his needs. So i will use this: final Pattern userIdPattern = Pattern.compile("([^@]+)[@]{0,1}.*");

    – Henfo
    Nov 21 '18 at 7:19













  • @Henfo [@]{0,1} is redundant, it makes no difference if there is [@]{0,1} inside the pattern or not.

    – Wiktor Stribiżew
    Nov 21 '18 at 8:31



















1














A little bit of googling came up with this:



(.*?)(?=@|$)


Will match everthing before an optional @






share|improve this answer
























  • see stackoverflow.com/questions/5979342/… for where I got this

    – Michael Wiles
    Nov 20 '18 at 20:45











  • Depending on the Java code where this pattern is used, it might not work what is expected.

    – Wiktor Stribiżew
    Nov 20 '18 at 20:51











  • @WiktorStribiżew I'm intrigued... why won't it?

    – Michael Wiles
    Nov 20 '18 at 20:53











  • If you use it with .matches(), Group 1 for user@domain.com string will be the whole string. You borrowed the pattern from PHP related question, and in PHP, the preg_match function returns partial matches.

    – Wiktor Stribiżew
    Nov 20 '18 at 20:56





















0














I would suggest keeping it simple and not relying on regex in this case if you are using java and have a simple case like you provided.



You could simply do something like this:



String userId = "user@test";

if (userId.indexOf("@") != -1)
userId = userId.substring(0, userId.indexOf("@"));

// from here on userId will be "user".


This will always either strip out the "@test" or just skip stripping it out when it is not there.



Using regex in most cases makes the code less maintainable by another dev in the future because most devs are not very good with regular expressions, at least in my experience.






share|improve this answer































    0














    You included the @ as optional, so the match tries to get the longest user name. As you didn't put the restriction of a username is not allowed to have @s in it, it matched the longest string.



    Just use:



    [^@]*


    as the matching subexpr for usernames (and use $0 to get the matched string)



    Or you can use this one that can be used to find several matches (and to get both the user part and the domain part):



    b([^@s]*)(@[^@s]*)?b


    The b force your string to be tied to word boundaries, then the first group matches non-space and non-@ chars (any number, better to use + instead of * there, as usernames must have at least one char) followed (optionally) by a @ and another string of non-space and non-@ chars). In this case, $0 matches the whole email addres, $1 matches the username part, and $2 the @domain part (you can refine to only the domain part, adding a new pair of parenthesis, as in



    b([^@s]*)(@([^@s]*))?b


    See demo.






    share|improve this answer























      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%2f53400529%2fregex-to-match-user-and-userdomain%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      If you use "(.*)[@]{0,1}.*" pattern with .matches(), the (.*) grabs the whole line first, then, when the regex index is still at the end of the line, the [@]{0,1} pattern triggers and matches at the end of the line because it can match 0 @ chars, and then .* again matches at that very location as it matches any 0+ chars. Thus, the whole line lands in your Group 1.



      You may use



      String userId = s.replaceFirst("^([^@]+).*", "$1");


      See the regex demo.



      Details





      • ^ - start of string


      • ([^@]+) - Group 1 (referred to with $1 from the replacement pattern): any 1+ chars other than @


      • .* - the rest of the string.






      share|improve this answer
























      • Thanks, this answered my question. An admin is allowed to edit matching patterns to his needs. So i will use this: final Pattern userIdPattern = Pattern.compile("([^@]+)[@]{0,1}.*");

        – Henfo
        Nov 21 '18 at 7:19













      • @Henfo [@]{0,1} is redundant, it makes no difference if there is [@]{0,1} inside the pattern or not.

        – Wiktor Stribiżew
        Nov 21 '18 at 8:31
















      2














      If you use "(.*)[@]{0,1}.*" pattern with .matches(), the (.*) grabs the whole line first, then, when the regex index is still at the end of the line, the [@]{0,1} pattern triggers and matches at the end of the line because it can match 0 @ chars, and then .* again matches at that very location as it matches any 0+ chars. Thus, the whole line lands in your Group 1.



      You may use



      String userId = s.replaceFirst("^([^@]+).*", "$1");


      See the regex demo.



      Details





      • ^ - start of string


      • ([^@]+) - Group 1 (referred to with $1 from the replacement pattern): any 1+ chars other than @


      • .* - the rest of the string.






      share|improve this answer
























      • Thanks, this answered my question. An admin is allowed to edit matching patterns to his needs. So i will use this: final Pattern userIdPattern = Pattern.compile("([^@]+)[@]{0,1}.*");

        – Henfo
        Nov 21 '18 at 7:19













      • @Henfo [@]{0,1} is redundant, it makes no difference if there is [@]{0,1} inside the pattern or not.

        – Wiktor Stribiżew
        Nov 21 '18 at 8:31














      2












      2








      2







      If you use "(.*)[@]{0,1}.*" pattern with .matches(), the (.*) grabs the whole line first, then, when the regex index is still at the end of the line, the [@]{0,1} pattern triggers and matches at the end of the line because it can match 0 @ chars, and then .* again matches at that very location as it matches any 0+ chars. Thus, the whole line lands in your Group 1.



      You may use



      String userId = s.replaceFirst("^([^@]+).*", "$1");


      See the regex demo.



      Details





      • ^ - start of string


      • ([^@]+) - Group 1 (referred to with $1 from the replacement pattern): any 1+ chars other than @


      • .* - the rest of the string.






      share|improve this answer













      If you use "(.*)[@]{0,1}.*" pattern with .matches(), the (.*) grabs the whole line first, then, when the regex index is still at the end of the line, the [@]{0,1} pattern triggers and matches at the end of the line because it can match 0 @ chars, and then .* again matches at that very location as it matches any 0+ chars. Thus, the whole line lands in your Group 1.



      You may use



      String userId = s.replaceFirst("^([^@]+).*", "$1");


      See the regex demo.



      Details





      • ^ - start of string


      • ([^@]+) - Group 1 (referred to with $1 from the replacement pattern): any 1+ chars other than @


      • .* - the rest of the string.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Nov 20 '18 at 19:57









      Wiktor StribiżewWiktor Stribiżew

      322k16142223




      322k16142223













      • Thanks, this answered my question. An admin is allowed to edit matching patterns to his needs. So i will use this: final Pattern userIdPattern = Pattern.compile("([^@]+)[@]{0,1}.*");

        – Henfo
        Nov 21 '18 at 7:19













      • @Henfo [@]{0,1} is redundant, it makes no difference if there is [@]{0,1} inside the pattern or not.

        – Wiktor Stribiżew
        Nov 21 '18 at 8:31



















      • Thanks, this answered my question. An admin is allowed to edit matching patterns to his needs. So i will use this: final Pattern userIdPattern = Pattern.compile("([^@]+)[@]{0,1}.*");

        – Henfo
        Nov 21 '18 at 7:19













      • @Henfo [@]{0,1} is redundant, it makes no difference if there is [@]{0,1} inside the pattern or not.

        – Wiktor Stribiżew
        Nov 21 '18 at 8:31

















      Thanks, this answered my question. An admin is allowed to edit matching patterns to his needs. So i will use this: final Pattern userIdPattern = Pattern.compile("([^@]+)[@]{0,1}.*");

      – Henfo
      Nov 21 '18 at 7:19







      Thanks, this answered my question. An admin is allowed to edit matching patterns to his needs. So i will use this: final Pattern userIdPattern = Pattern.compile("([^@]+)[@]{0,1}.*");

      – Henfo
      Nov 21 '18 at 7:19















      @Henfo [@]{0,1} is redundant, it makes no difference if there is [@]{0,1} inside the pattern or not.

      – Wiktor Stribiżew
      Nov 21 '18 at 8:31





      @Henfo [@]{0,1} is redundant, it makes no difference if there is [@]{0,1} inside the pattern or not.

      – Wiktor Stribiżew
      Nov 21 '18 at 8:31













      1














      A little bit of googling came up with this:



      (.*?)(?=@|$)


      Will match everthing before an optional @






      share|improve this answer
























      • see stackoverflow.com/questions/5979342/… for where I got this

        – Michael Wiles
        Nov 20 '18 at 20:45











      • Depending on the Java code where this pattern is used, it might not work what is expected.

        – Wiktor Stribiżew
        Nov 20 '18 at 20:51











      • @WiktorStribiżew I'm intrigued... why won't it?

        – Michael Wiles
        Nov 20 '18 at 20:53











      • If you use it with .matches(), Group 1 for user@domain.com string will be the whole string. You borrowed the pattern from PHP related question, and in PHP, the preg_match function returns partial matches.

        – Wiktor Stribiżew
        Nov 20 '18 at 20:56


















      1














      A little bit of googling came up with this:



      (.*?)(?=@|$)


      Will match everthing before an optional @






      share|improve this answer
























      • see stackoverflow.com/questions/5979342/… for where I got this

        – Michael Wiles
        Nov 20 '18 at 20:45











      • Depending on the Java code where this pattern is used, it might not work what is expected.

        – Wiktor Stribiżew
        Nov 20 '18 at 20:51











      • @WiktorStribiżew I'm intrigued... why won't it?

        – Michael Wiles
        Nov 20 '18 at 20:53











      • If you use it with .matches(), Group 1 for user@domain.com string will be the whole string. You borrowed the pattern from PHP related question, and in PHP, the preg_match function returns partial matches.

        – Wiktor Stribiżew
        Nov 20 '18 at 20:56
















      1












      1








      1







      A little bit of googling came up with this:



      (.*?)(?=@|$)


      Will match everthing before an optional @






      share|improve this answer













      A little bit of googling came up with this:



      (.*?)(?=@|$)


      Will match everthing before an optional @







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Nov 20 '18 at 20:34









      Michael WilesMichael Wiles

      14.9k165692




      14.9k165692













      • see stackoverflow.com/questions/5979342/… for where I got this

        – Michael Wiles
        Nov 20 '18 at 20:45











      • Depending on the Java code where this pattern is used, it might not work what is expected.

        – Wiktor Stribiżew
        Nov 20 '18 at 20:51











      • @WiktorStribiżew I'm intrigued... why won't it?

        – Michael Wiles
        Nov 20 '18 at 20:53











      • If you use it with .matches(), Group 1 for user@domain.com string will be the whole string. You borrowed the pattern from PHP related question, and in PHP, the preg_match function returns partial matches.

        – Wiktor Stribiżew
        Nov 20 '18 at 20:56





















      • see stackoverflow.com/questions/5979342/… for where I got this

        – Michael Wiles
        Nov 20 '18 at 20:45











      • Depending on the Java code where this pattern is used, it might not work what is expected.

        – Wiktor Stribiżew
        Nov 20 '18 at 20:51











      • @WiktorStribiżew I'm intrigued... why won't it?

        – Michael Wiles
        Nov 20 '18 at 20:53











      • If you use it with .matches(), Group 1 for user@domain.com string will be the whole string. You borrowed the pattern from PHP related question, and in PHP, the preg_match function returns partial matches.

        – Wiktor Stribiżew
        Nov 20 '18 at 20:56



















      see stackoverflow.com/questions/5979342/… for where I got this

      – Michael Wiles
      Nov 20 '18 at 20:45





      see stackoverflow.com/questions/5979342/… for where I got this

      – Michael Wiles
      Nov 20 '18 at 20:45













      Depending on the Java code where this pattern is used, it might not work what is expected.

      – Wiktor Stribiżew
      Nov 20 '18 at 20:51





      Depending on the Java code where this pattern is used, it might not work what is expected.

      – Wiktor Stribiżew
      Nov 20 '18 at 20:51













      @WiktorStribiżew I'm intrigued... why won't it?

      – Michael Wiles
      Nov 20 '18 at 20:53





      @WiktorStribiżew I'm intrigued... why won't it?

      – Michael Wiles
      Nov 20 '18 at 20:53













      If you use it with .matches(), Group 1 for user@domain.com string will be the whole string. You borrowed the pattern from PHP related question, and in PHP, the preg_match function returns partial matches.

      – Wiktor Stribiżew
      Nov 20 '18 at 20:56







      If you use it with .matches(), Group 1 for user@domain.com string will be the whole string. You borrowed the pattern from PHP related question, and in PHP, the preg_match function returns partial matches.

      – Wiktor Stribiżew
      Nov 20 '18 at 20:56













      0














      I would suggest keeping it simple and not relying on regex in this case if you are using java and have a simple case like you provided.



      You could simply do something like this:



      String userId = "user@test";

      if (userId.indexOf("@") != -1)
      userId = userId.substring(0, userId.indexOf("@"));

      // from here on userId will be "user".


      This will always either strip out the "@test" or just skip stripping it out when it is not there.



      Using regex in most cases makes the code less maintainable by another dev in the future because most devs are not very good with regular expressions, at least in my experience.






      share|improve this answer




























        0














        I would suggest keeping it simple and not relying on regex in this case if you are using java and have a simple case like you provided.



        You could simply do something like this:



        String userId = "user@test";

        if (userId.indexOf("@") != -1)
        userId = userId.substring(0, userId.indexOf("@"));

        // from here on userId will be "user".


        This will always either strip out the "@test" or just skip stripping it out when it is not there.



        Using regex in most cases makes the code less maintainable by another dev in the future because most devs are not very good with regular expressions, at least in my experience.






        share|improve this answer


























          0












          0








          0







          I would suggest keeping it simple and not relying on regex in this case if you are using java and have a simple case like you provided.



          You could simply do something like this:



          String userId = "user@test";

          if (userId.indexOf("@") != -1)
          userId = userId.substring(0, userId.indexOf("@"));

          // from here on userId will be "user".


          This will always either strip out the "@test" or just skip stripping it out when it is not there.



          Using regex in most cases makes the code less maintainable by another dev in the future because most devs are not very good with regular expressions, at least in my experience.






          share|improve this answer













          I would suggest keeping it simple and not relying on regex in this case if you are using java and have a simple case like you provided.



          You could simply do something like this:



          String userId = "user@test";

          if (userId.indexOf("@") != -1)
          userId = userId.substring(0, userId.indexOf("@"));

          // from here on userId will be "user".


          This will always either strip out the "@test" or just skip stripping it out when it is not there.



          Using regex in most cases makes the code less maintainable by another dev in the future because most devs are not very good with regular expressions, at least in my experience.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 '18 at 20:10









          JustSomeDudeJustSomeDude

          869812




          869812























              0














              You included the @ as optional, so the match tries to get the longest user name. As you didn't put the restriction of a username is not allowed to have @s in it, it matched the longest string.



              Just use:



              [^@]*


              as the matching subexpr for usernames (and use $0 to get the matched string)



              Or you can use this one that can be used to find several matches (and to get both the user part and the domain part):



              b([^@s]*)(@[^@s]*)?b


              The b force your string to be tied to word boundaries, then the first group matches non-space and non-@ chars (any number, better to use + instead of * there, as usernames must have at least one char) followed (optionally) by a @ and another string of non-space and non-@ chars). In this case, $0 matches the whole email addres, $1 matches the username part, and $2 the @domain part (you can refine to only the domain part, adding a new pair of parenthesis, as in



              b([^@s]*)(@([^@s]*))?b


              See demo.






              share|improve this answer




























                0














                You included the @ as optional, so the match tries to get the longest user name. As you didn't put the restriction of a username is not allowed to have @s in it, it matched the longest string.



                Just use:



                [^@]*


                as the matching subexpr for usernames (and use $0 to get the matched string)



                Or you can use this one that can be used to find several matches (and to get both the user part and the domain part):



                b([^@s]*)(@[^@s]*)?b


                The b force your string to be tied to word boundaries, then the first group matches non-space and non-@ chars (any number, better to use + instead of * there, as usernames must have at least one char) followed (optionally) by a @ and another string of non-space and non-@ chars). In this case, $0 matches the whole email addres, $1 matches the username part, and $2 the @domain part (you can refine to only the domain part, adding a new pair of parenthesis, as in



                b([^@s]*)(@([^@s]*))?b


                See demo.






                share|improve this answer


























                  0












                  0








                  0







                  You included the @ as optional, so the match tries to get the longest user name. As you didn't put the restriction of a username is not allowed to have @s in it, it matched the longest string.



                  Just use:



                  [^@]*


                  as the matching subexpr for usernames (and use $0 to get the matched string)



                  Or you can use this one that can be used to find several matches (and to get both the user part and the domain part):



                  b([^@s]*)(@[^@s]*)?b


                  The b force your string to be tied to word boundaries, then the first group matches non-space and non-@ chars (any number, better to use + instead of * there, as usernames must have at least one char) followed (optionally) by a @ and another string of non-space and non-@ chars). In this case, $0 matches the whole email addres, $1 matches the username part, and $2 the @domain part (you can refine to only the domain part, adding a new pair of parenthesis, as in



                  b([^@s]*)(@([^@s]*))?b


                  See demo.






                  share|improve this answer













                  You included the @ as optional, so the match tries to get the longest user name. As you didn't put the restriction of a username is not allowed to have @s in it, it matched the longest string.



                  Just use:



                  [^@]*


                  as the matching subexpr for usernames (and use $0 to get the matched string)



                  Or you can use this one that can be used to find several matches (and to get both the user part and the domain part):



                  b([^@s]*)(@[^@s]*)?b


                  The b force your string to be tied to word boundaries, then the first group matches non-space and non-@ chars (any number, better to use + instead of * there, as usernames must have at least one char) followed (optionally) by a @ and another string of non-space and non-@ chars). In this case, $0 matches the whole email addres, $1 matches the username part, and $2 the @domain part (you can refine to only the domain part, adding a new pair of parenthesis, as in



                  b([^@s]*)(@([^@s]*))?b


                  See demo.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 22 '18 at 6:25









                  Luis ColoradoLuis Colorado

                  4,3751718




                  4,3751718






























                      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%2f53400529%2fregex-to-match-user-and-userdomain%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

                      Guess what letter conforming each word

                      Port of Spain

                      Run scheduled task as local user group (not BUILTIN)