New to regex and using it for a project. Need help with a regexp replace statement. Any ideas?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












Need help returning a string "Great Wolf Items" case insensitive that also accounts for a space or underscore between words.



I tried (GreatwWolfwitem*s)/i but it won't work in the tableau software I'm using.







share|improve this question

















  • 1




    What regex engine / flavor are you using, and what have you tried?
    – steeldriver
    Jun 14 at 16:32










  • I am using it within tableau software. I tried (GreatwWolfwitem*s)/i to include the case insensitivity and space, underscore, or character but it won't work.
    – John Christopher
    Jun 14 at 16:46










  • I'm not familiar with this software. What type of Regex does its documentation say it uses? (Abbreviations like ERE or PCRE would be good.)
    – roaima
    Jun 15 at 8:40






  • 1




    You talk about replacement in the title, but the question itself does not mention this.
    – Kusalananda
    Jun 15 at 9:00














up vote
0
down vote

favorite












Need help returning a string "Great Wolf Items" case insensitive that also accounts for a space or underscore between words.



I tried (GreatwWolfwitem*s)/i but it won't work in the tableau software I'm using.







share|improve this question

















  • 1




    What regex engine / flavor are you using, and what have you tried?
    – steeldriver
    Jun 14 at 16:32










  • I am using it within tableau software. I tried (GreatwWolfwitem*s)/i to include the case insensitivity and space, underscore, or character but it won't work.
    – John Christopher
    Jun 14 at 16:46










  • I'm not familiar with this software. What type of Regex does its documentation say it uses? (Abbreviations like ERE or PCRE would be good.)
    – roaima
    Jun 15 at 8:40






  • 1




    You talk about replacement in the title, but the question itself does not mention this.
    – Kusalananda
    Jun 15 at 9:00












up vote
0
down vote

favorite









up vote
0
down vote

favorite











Need help returning a string "Great Wolf Items" case insensitive that also accounts for a space or underscore between words.



I tried (GreatwWolfwitem*s)/i but it won't work in the tableau software I'm using.







share|improve this question













Need help returning a string "Great Wolf Items" case insensitive that also accounts for a space or underscore between words.



I tried (GreatwWolfwitem*s)/i but it won't work in the tableau software I'm using.









share|improve this question












share|improve this question




share|improve this question








edited Jun 15 at 8:42









roaima

39.2k544105




39.2k544105









asked Jun 14 at 16:27









John Christopher

1




1







  • 1




    What regex engine / flavor are you using, and what have you tried?
    – steeldriver
    Jun 14 at 16:32










  • I am using it within tableau software. I tried (GreatwWolfwitem*s)/i to include the case insensitivity and space, underscore, or character but it won't work.
    – John Christopher
    Jun 14 at 16:46










  • I'm not familiar with this software. What type of Regex does its documentation say it uses? (Abbreviations like ERE or PCRE would be good.)
    – roaima
    Jun 15 at 8:40






  • 1




    You talk about replacement in the title, but the question itself does not mention this.
    – Kusalananda
    Jun 15 at 9:00












  • 1




    What regex engine / flavor are you using, and what have you tried?
    – steeldriver
    Jun 14 at 16:32










  • I am using it within tableau software. I tried (GreatwWolfwitem*s)/i to include the case insensitivity and space, underscore, or character but it won't work.
    – John Christopher
    Jun 14 at 16:46










  • I'm not familiar with this software. What type of Regex does its documentation say it uses? (Abbreviations like ERE or PCRE would be good.)
    – roaima
    Jun 15 at 8:40






  • 1




    You talk about replacement in the title, but the question itself does not mention this.
    – Kusalananda
    Jun 15 at 9:00







1




1




What regex engine / flavor are you using, and what have you tried?
– steeldriver
Jun 14 at 16:32




What regex engine / flavor are you using, and what have you tried?
– steeldriver
Jun 14 at 16:32












I am using it within tableau software. I tried (GreatwWolfwitem*s)/i to include the case insensitivity and space, underscore, or character but it won't work.
– John Christopher
Jun 14 at 16:46




I am using it within tableau software. I tried (GreatwWolfwitem*s)/i to include the case insensitivity and space, underscore, or character but it won't work.
– John Christopher
Jun 14 at 16:46












I'm not familiar with this software. What type of Regex does its documentation say it uses? (Abbreviations like ERE or PCRE would be good.)
– roaima
Jun 15 at 8:40




I'm not familiar with this software. What type of Regex does its documentation say it uses? (Abbreviations like ERE or PCRE would be good.)
– roaima
Jun 15 at 8:40




1




1




You talk about replacement in the title, but the question itself does not mention this.
– Kusalananda
Jun 15 at 9:00




You talk about replacement in the title, but the question itself does not mention this.
– Kusalananda
Jun 15 at 9:00










3 Answers
3






active

oldest

votes

















up vote
0
down vote













One fairly universal expression would be:



/[Gg]reat[_ ][Ww]olf[_ ][Ii]tems/





share|improve this answer





















  • Or /[Gg][Rr][Ee][Aa][Tt][_ ][Ww][Oo][Ll][Ff][_ ][Ii][Tt][Ee][Mm][Ss]/,  to be really case insensitive.
    – G-Man
    Jun 15 at 5:46










  • Mind Ggggreat and itemses
    – roaima
    Jun 16 at 22:17










  • @roaima: What?  Oh, I guess I see what you’re saying.  So what?  Ggggreat and itemses is a valid match; the question says “space or underscore between words.”
    – G-Man
    Jun 17 at 19:33











  • @G-Man it's the word boundary on the start of Great or the end of items that's missing
    – roaima
    Jun 17 at 19:44






  • 2




    IANAL, but my argument is that the question doesn’t really specify that there should be one: it says “returning a string” with “space or underscore between words.” It doesn’t say anything about a word break before the first word or after the last one. (JK; your answer probably is better for what the OP really wants.)    :-)    ⁠
    – G-Man
    Jun 17 at 19:49

















up vote
0
down vote













Assuming PCRE, the regular expression you've tried cannot match what you're looking for. Let's break it down:



(GreatwWolfwitem*s)/i


  • The w is a marker that says "a character that could belong to a word of text". So it could match E or p or even 6, but not a space.

  • The * character means "zero of more of the preceding item", which in this case is the letter m. I'm not entirely sure what you think it should be doing; if you're trying to make the s optional you need a marker after that character.

If your overall syntax and RE engine is correct, this would match the consecutive words "Great", "Wolf", "Item"/"Items" having one or more spaces between them, in a case insensitive manner:



(bGreats+Wolfs+Items?b)/i


  • the b forces a word boundary (preventing `Ggggreat", for example)

  • the s+ is "one or more spaces" (+ is "one or more of...")

  • the s? means that the letter s is optional (? is "zero or one of...")





share|improve this answer




























    up vote
    0
    down vote













    If I read the Tableau documentation and the documentation on ICU regular expression referred to in there correctly, you should be able to use



    (?i:Great[ _]Wolf[ _]Items)


    as the regular expression. The ?i in (?i:RE) turns case sensitivity off for matching the regular expression RE.






    share|improve this answer





















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      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',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );








       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f449849%2fnew-to-regex-and-using-it-for-a-project-need-help-with-a-regexp-replace-stateme%23new-answer', 'question_page');

      );

      Post as a guest






























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      0
      down vote













      One fairly universal expression would be:



      /[Gg]reat[_ ][Ww]olf[_ ][Ii]tems/





      share|improve this answer





















      • Or /[Gg][Rr][Ee][Aa][Tt][_ ][Ww][Oo][Ll][Ff][_ ][Ii][Tt][Ee][Mm][Ss]/,  to be really case insensitive.
        – G-Man
        Jun 15 at 5:46










      • Mind Ggggreat and itemses
        – roaima
        Jun 16 at 22:17










      • @roaima: What?  Oh, I guess I see what you’re saying.  So what?  Ggggreat and itemses is a valid match; the question says “space or underscore between words.”
        – G-Man
        Jun 17 at 19:33











      • @G-Man it's the word boundary on the start of Great or the end of items that's missing
        – roaima
        Jun 17 at 19:44






      • 2




        IANAL, but my argument is that the question doesn’t really specify that there should be one: it says “returning a string” with “space or underscore between words.” It doesn’t say anything about a word break before the first word or after the last one. (JK; your answer probably is better for what the OP really wants.)    :-)    ⁠
        – G-Man
        Jun 17 at 19:49














      up vote
      0
      down vote













      One fairly universal expression would be:



      /[Gg]reat[_ ][Ww]olf[_ ][Ii]tems/





      share|improve this answer





















      • Or /[Gg][Rr][Ee][Aa][Tt][_ ][Ww][Oo][Ll][Ff][_ ][Ii][Tt][Ee][Mm][Ss]/,  to be really case insensitive.
        – G-Man
        Jun 15 at 5:46










      • Mind Ggggreat and itemses
        – roaima
        Jun 16 at 22:17










      • @roaima: What?  Oh, I guess I see what you’re saying.  So what?  Ggggreat and itemses is a valid match; the question says “space or underscore between words.”
        – G-Man
        Jun 17 at 19:33











      • @G-Man it's the word boundary on the start of Great or the end of items that's missing
        – roaima
        Jun 17 at 19:44






      • 2




        IANAL, but my argument is that the question doesn’t really specify that there should be one: it says “returning a string” with “space or underscore between words.” It doesn’t say anything about a word break before the first word or after the last one. (JK; your answer probably is better for what the OP really wants.)    :-)    ⁠
        – G-Man
        Jun 17 at 19:49












      up vote
      0
      down vote










      up vote
      0
      down vote









      One fairly universal expression would be:



      /[Gg]reat[_ ][Ww]olf[_ ][Ii]tems/





      share|improve this answer













      One fairly universal expression would be:



      /[Gg]reat[_ ][Ww]olf[_ ][Ii]tems/






      share|improve this answer













      share|improve this answer



      share|improve this answer











      answered Jun 14 at 17:10









      DopeGhoti

      39.8k54779




      39.8k54779











      • Or /[Gg][Rr][Ee][Aa][Tt][_ ][Ww][Oo][Ll][Ff][_ ][Ii][Tt][Ee][Mm][Ss]/,  to be really case insensitive.
        – G-Man
        Jun 15 at 5:46










      • Mind Ggggreat and itemses
        – roaima
        Jun 16 at 22:17










      • @roaima: What?  Oh, I guess I see what you’re saying.  So what?  Ggggreat and itemses is a valid match; the question says “space or underscore between words.”
        – G-Man
        Jun 17 at 19:33











      • @G-Man it's the word boundary on the start of Great or the end of items that's missing
        – roaima
        Jun 17 at 19:44






      • 2




        IANAL, but my argument is that the question doesn’t really specify that there should be one: it says “returning a string” with “space or underscore between words.” It doesn’t say anything about a word break before the first word or after the last one. (JK; your answer probably is better for what the OP really wants.)    :-)    ⁠
        – G-Man
        Jun 17 at 19:49
















      • Or /[Gg][Rr][Ee][Aa][Tt][_ ][Ww][Oo][Ll][Ff][_ ][Ii][Tt][Ee][Mm][Ss]/,  to be really case insensitive.
        – G-Man
        Jun 15 at 5:46










      • Mind Ggggreat and itemses
        – roaima
        Jun 16 at 22:17










      • @roaima: What?  Oh, I guess I see what you’re saying.  So what?  Ggggreat and itemses is a valid match; the question says “space or underscore between words.”
        – G-Man
        Jun 17 at 19:33











      • @G-Man it's the word boundary on the start of Great or the end of items that's missing
        – roaima
        Jun 17 at 19:44






      • 2




        IANAL, but my argument is that the question doesn’t really specify that there should be one: it says “returning a string” with “space or underscore between words.” It doesn’t say anything about a word break before the first word or after the last one. (JK; your answer probably is better for what the OP really wants.)    :-)    ⁠
        – G-Man
        Jun 17 at 19:49















      Or /[Gg][Rr][Ee][Aa][Tt][_ ][Ww][Oo][Ll][Ff][_ ][Ii][Tt][Ee][Mm][Ss]/,  to be really case insensitive.
      – G-Man
      Jun 15 at 5:46




      Or /[Gg][Rr][Ee][Aa][Tt][_ ][Ww][Oo][Ll][Ff][_ ][Ii][Tt][Ee][Mm][Ss]/,  to be really case insensitive.
      – G-Man
      Jun 15 at 5:46












      Mind Ggggreat and itemses
      – roaima
      Jun 16 at 22:17




      Mind Ggggreat and itemses
      – roaima
      Jun 16 at 22:17












      @roaima: What?  Oh, I guess I see what you’re saying.  So what?  Ggggreat and itemses is a valid match; the question says “space or underscore between words.”
      – G-Man
      Jun 17 at 19:33





      @roaima: What?  Oh, I guess I see what you’re saying.  So what?  Ggggreat and itemses is a valid match; the question says “space or underscore between words.”
      – G-Man
      Jun 17 at 19:33













      @G-Man it's the word boundary on the start of Great or the end of items that's missing
      – roaima
      Jun 17 at 19:44




      @G-Man it's the word boundary on the start of Great or the end of items that's missing
      – roaima
      Jun 17 at 19:44




      2




      2




      IANAL, but my argument is that the question doesn’t really specify that there should be one: it says “returning a string” with “space or underscore between words.” It doesn’t say anything about a word break before the first word or after the last one. (JK; your answer probably is better for what the OP really wants.)    :-)    ⁠
      – G-Man
      Jun 17 at 19:49




      IANAL, but my argument is that the question doesn’t really specify that there should be one: it says “returning a string” with “space or underscore between words.” It doesn’t say anything about a word break before the first word or after the last one. (JK; your answer probably is better for what the OP really wants.)    :-)    ⁠
      – G-Man
      Jun 17 at 19:49












      up vote
      0
      down vote













      Assuming PCRE, the regular expression you've tried cannot match what you're looking for. Let's break it down:



      (GreatwWolfwitem*s)/i


      • The w is a marker that says "a character that could belong to a word of text". So it could match E or p or even 6, but not a space.

      • The * character means "zero of more of the preceding item", which in this case is the letter m. I'm not entirely sure what you think it should be doing; if you're trying to make the s optional you need a marker after that character.

      If your overall syntax and RE engine is correct, this would match the consecutive words "Great", "Wolf", "Item"/"Items" having one or more spaces between them, in a case insensitive manner:



      (bGreats+Wolfs+Items?b)/i


      • the b forces a word boundary (preventing `Ggggreat", for example)

      • the s+ is "one or more spaces" (+ is "one or more of...")

      • the s? means that the letter s is optional (? is "zero or one of...")





      share|improve this answer

























        up vote
        0
        down vote













        Assuming PCRE, the regular expression you've tried cannot match what you're looking for. Let's break it down:



        (GreatwWolfwitem*s)/i


        • The w is a marker that says "a character that could belong to a word of text". So it could match E or p or even 6, but not a space.

        • The * character means "zero of more of the preceding item", which in this case is the letter m. I'm not entirely sure what you think it should be doing; if you're trying to make the s optional you need a marker after that character.

        If your overall syntax and RE engine is correct, this would match the consecutive words "Great", "Wolf", "Item"/"Items" having one or more spaces between them, in a case insensitive manner:



        (bGreats+Wolfs+Items?b)/i


        • the b forces a word boundary (preventing `Ggggreat", for example)

        • the s+ is "one or more spaces" (+ is "one or more of...")

        • the s? means that the letter s is optional (? is "zero or one of...")





        share|improve this answer























          up vote
          0
          down vote










          up vote
          0
          down vote









          Assuming PCRE, the regular expression you've tried cannot match what you're looking for. Let's break it down:



          (GreatwWolfwitem*s)/i


          • The w is a marker that says "a character that could belong to a word of text". So it could match E or p or even 6, but not a space.

          • The * character means "zero of more of the preceding item", which in this case is the letter m. I'm not entirely sure what you think it should be doing; if you're trying to make the s optional you need a marker after that character.

          If your overall syntax and RE engine is correct, this would match the consecutive words "Great", "Wolf", "Item"/"Items" having one or more spaces between them, in a case insensitive manner:



          (bGreats+Wolfs+Items?b)/i


          • the b forces a word boundary (preventing `Ggggreat", for example)

          • the s+ is "one or more spaces" (+ is "one or more of...")

          • the s? means that the letter s is optional (? is "zero or one of...")





          share|improve this answer













          Assuming PCRE, the regular expression you've tried cannot match what you're looking for. Let's break it down:



          (GreatwWolfwitem*s)/i


          • The w is a marker that says "a character that could belong to a word of text". So it could match E or p or even 6, but not a space.

          • The * character means "zero of more of the preceding item", which in this case is the letter m. I'm not entirely sure what you think it should be doing; if you're trying to make the s optional you need a marker after that character.

          If your overall syntax and RE engine is correct, this would match the consecutive words "Great", "Wolf", "Item"/"Items" having one or more spaces between them, in a case insensitive manner:



          (bGreats+Wolfs+Items?b)/i


          • the b forces a word boundary (preventing `Ggggreat", for example)

          • the s+ is "one or more spaces" (+ is "one or more of...")

          • the s? means that the letter s is optional (? is "zero or one of...")






          share|improve this answer













          share|improve this answer



          share|improve this answer











          answered Jun 15 at 8:49









          roaima

          39.2k544105




          39.2k544105




















              up vote
              0
              down vote













              If I read the Tableau documentation and the documentation on ICU regular expression referred to in there correctly, you should be able to use



              (?i:Great[ _]Wolf[ _]Items)


              as the regular expression. The ?i in (?i:RE) turns case sensitivity off for matching the regular expression RE.






              share|improve this answer

























                up vote
                0
                down vote













                If I read the Tableau documentation and the documentation on ICU regular expression referred to in there correctly, you should be able to use



                (?i:Great[ _]Wolf[ _]Items)


                as the regular expression. The ?i in (?i:RE) turns case sensitivity off for matching the regular expression RE.






                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  If I read the Tableau documentation and the documentation on ICU regular expression referred to in there correctly, you should be able to use



                  (?i:Great[ _]Wolf[ _]Items)


                  as the regular expression. The ?i in (?i:RE) turns case sensitivity off for matching the regular expression RE.






                  share|improve this answer













                  If I read the Tableau documentation and the documentation on ICU regular expression referred to in there correctly, you should be able to use



                  (?i:Great[ _]Wolf[ _]Items)


                  as the regular expression. The ?i in (?i:RE) turns case sensitivity off for matching the regular expression RE.







                  share|improve this answer













                  share|improve this answer



                  share|improve this answer











                  answered Jun 15 at 8:57









                  Kusalananda

                  101k13199312




                  101k13199312






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f449849%2fnew-to-regex-and-using-it-for-a-project-need-help-with-a-regexp-replace-stateme%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay