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

Clash 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.
regular-expression
add a comment |Â
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.
regular-expression
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
add a comment |Â
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.
regular-expression
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.
regular-expression
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
add a comment |Â
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
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
0
down vote
One fairly universal expression would be:
/[Gg]reat[_ ][Ww]olf[_ ][Ii]tems/
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
MindGgggreatanditemses
â roaima
Jun 16 at 22:17
@roaima:âÂÂWhat?â Oh, I guess I see what youâÂÂre saying.â So what?âÂÂGgggreat and itemsesis 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 ofGreator the end ofitemsthat'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
add a comment |Â
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
wis a marker that says "a character that could belong to a word of text". So it could matchEorpor even6, but not a space. - The
*character means "zero of more of the preceding item", which in this case is the letterm. I'm not entirely sure what you think it should be doing; if you're trying to make thesoptional 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
bforces a word boundary (preventing `Ggggreat", for example) - the
s+is "one or more spaces" (+is "one or more of...") - the
s?means that the lettersis optional (?is "zero or one of...")
add a comment |Â
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.
add a comment |Â
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/
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
MindGgggreatanditemses
â roaima
Jun 16 at 22:17
@roaima:âÂÂWhat?â Oh, I guess I see what youâÂÂre saying.â So what?âÂÂGgggreat and itemsesis 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 ofGreator the end ofitemsthat'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
add a comment |Â
up vote
0
down vote
One fairly universal expression would be:
/[Gg]reat[_ ][Ww]olf[_ ][Ii]tems/
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
MindGgggreatanditemses
â roaima
Jun 16 at 22:17
@roaima:âÂÂWhat?â Oh, I guess I see what youâÂÂre saying.â So what?âÂÂGgggreat and itemsesis 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 ofGreator the end ofitemsthat'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
add a comment |Â
up vote
0
down vote
up vote
0
down vote
One fairly universal expression would be:
/[Gg]reat[_ ][Ww]olf[_ ][Ii]tems/
One fairly universal expression would be:
/[Gg]reat[_ ][Ww]olf[_ ][Ii]tems/
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
MindGgggreatanditemses
â roaima
Jun 16 at 22:17
@roaima:âÂÂWhat?â Oh, I guess I see what youâÂÂre saying.â So what?âÂÂGgggreat and itemsesis 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 ofGreator the end ofitemsthat'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
add a comment |Â
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
MindGgggreatanditemses
â roaima
Jun 16 at 22:17
@roaima:âÂÂWhat?â Oh, I guess I see what youâÂÂre saying.â So what?âÂÂGgggreat and itemsesis 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 ofGreator the end ofitemsthat'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
add a comment |Â
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
wis a marker that says "a character that could belong to a word of text". So it could matchEorpor even6, but not a space. - The
*character means "zero of more of the preceding item", which in this case is the letterm. I'm not entirely sure what you think it should be doing; if you're trying to make thesoptional 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
bforces a word boundary (preventing `Ggggreat", for example) - the
s+is "one or more spaces" (+is "one or more of...") - the
s?means that the lettersis optional (?is "zero or one of...")
add a comment |Â
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
wis a marker that says "a character that could belong to a word of text". So it could matchEorpor even6, but not a space. - The
*character means "zero of more of the preceding item", which in this case is the letterm. I'm not entirely sure what you think it should be doing; if you're trying to make thesoptional 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
bforces a word boundary (preventing `Ggggreat", for example) - the
s+is "one or more spaces" (+is "one or more of...") - the
s?means that the lettersis optional (?is "zero or one of...")
add a comment |Â
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
wis a marker that says "a character that could belong to a word of text". So it could matchEorpor even6, but not a space. - The
*character means "zero of more of the preceding item", which in this case is the letterm. I'm not entirely sure what you think it should be doing; if you're trying to make thesoptional 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
bforces a word boundary (preventing `Ggggreat", for example) - the
s+is "one or more spaces" (+is "one or more of...") - the
s?means that the lettersis optional (?is "zero or one of...")
Assuming PCRE, the regular expression you've tried cannot match what you're looking for. Let's break it down:
(GreatwWolfwitem*s)/i
- The
wis a marker that says "a character that could belong to a word of text". So it could matchEorpor even6, but not a space. - The
*character means "zero of more of the preceding item", which in this case is the letterm. I'm not entirely sure what you think it should be doing; if you're trying to make thesoptional 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
bforces a word boundary (preventing `Ggggreat", for example) - the
s+is "one or more spaces" (+is "one or more of...") - the
s?means that the lettersis optional (?is "zero or one of...")
answered Jun 15 at 8:49
roaima
39.2k544105
39.2k544105
add a comment |Â
add a comment |Â
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.
add a comment |Â
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.
add a comment |Â
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.
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.
answered Jun 15 at 8:57
Kusalananda
101k13199312
101k13199312
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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