Regular Expression to match dot separated list with no dot on the end and allow asterisk at the end
I have the following input strings and I need a regex to validate the input.
test.test = OK
test.test.1 = OK
test.text* = OK
test.test. = NO
test.test.* = NO
test = NO
This is my regex, it works but does not successful validate the input as wished:
^[a-z0-9*.-_.:]+$
How can I get it work?
c# regex
add a comment |
I have the following input strings and I need a regex to validate the input.
test.test = OK
test.test.1 = OK
test.text* = OK
test.test. = NO
test.test.* = NO
test = NO
This is my regex, it works but does not successful validate the input as wished:
^[a-z0-9*.-_.:]+$
How can I get it work?
c# regex
What is the second regex? It is not quite clear what the rule related to*
is. I tried now with^(?!.*[.*]{2})[a-z0-9*_:-]+(?:.[a-z0-9*_:-]+)+$
, no idea if you meant that.
and*
cannot appear next to each other (or consecutive.
and*
are not allowed). You say allow asterisk at the end, but you also state thattest.test.*
is a no match.
– Wiktor Stribiżew
Nov 27 '18 at 9:03
Could you clarify the criteria for your regex, please? It's not this obvious.
– reartnew
Nov 27 '18 at 9:03
@WiktorStribiżew your regex is working. Please put is as answer and I will accept it.
– Dino
Nov 27 '18 at 9:06
add a comment |
I have the following input strings and I need a regex to validate the input.
test.test = OK
test.test.1 = OK
test.text* = OK
test.test. = NO
test.test.* = NO
test = NO
This is my regex, it works but does not successful validate the input as wished:
^[a-z0-9*.-_.:]+$
How can I get it work?
c# regex
I have the following input strings and I need a regex to validate the input.
test.test = OK
test.test.1 = OK
test.text* = OK
test.test. = NO
test.test.* = NO
test = NO
This is my regex, it works but does not successful validate the input as wished:
^[a-z0-9*.-_.:]+$
How can I get it work?
c# regex
c# regex
edited Nov 27 '18 at 9:07
Dino
asked Nov 27 '18 at 8:59
DinoDino
12719
12719
What is the second regex? It is not quite clear what the rule related to*
is. I tried now with^(?!.*[.*]{2})[a-z0-9*_:-]+(?:.[a-z0-9*_:-]+)+$
, no idea if you meant that.
and*
cannot appear next to each other (or consecutive.
and*
are not allowed). You say allow asterisk at the end, but you also state thattest.test.*
is a no match.
– Wiktor Stribiżew
Nov 27 '18 at 9:03
Could you clarify the criteria for your regex, please? It's not this obvious.
– reartnew
Nov 27 '18 at 9:03
@WiktorStribiżew your regex is working. Please put is as answer and I will accept it.
– Dino
Nov 27 '18 at 9:06
add a comment |
What is the second regex? It is not quite clear what the rule related to*
is. I tried now with^(?!.*[.*]{2})[a-z0-9*_:-]+(?:.[a-z0-9*_:-]+)+$
, no idea if you meant that.
and*
cannot appear next to each other (or consecutive.
and*
are not allowed). You say allow asterisk at the end, but you also state thattest.test.*
is a no match.
– Wiktor Stribiżew
Nov 27 '18 at 9:03
Could you clarify the criteria for your regex, please? It's not this obvious.
– reartnew
Nov 27 '18 at 9:03
@WiktorStribiżew your regex is working. Please put is as answer and I will accept it.
– Dino
Nov 27 '18 at 9:06
What is the second regex? It is not quite clear what the rule related to
*
is. I tried now with ^(?!.*[.*]{2})[a-z0-9*_:-]+(?:.[a-z0-9*_:-]+)+$
, no idea if you meant that .
and *
cannot appear next to each other (or consecutive .
and *
are not allowed). You say allow asterisk at the end, but you also state that test.test.*
is a no match.– Wiktor Stribiżew
Nov 27 '18 at 9:03
What is the second regex? It is not quite clear what the rule related to
*
is. I tried now with ^(?!.*[.*]{2})[a-z0-9*_:-]+(?:.[a-z0-9*_:-]+)+$
, no idea if you meant that .
and *
cannot appear next to each other (or consecutive .
and *
are not allowed). You say allow asterisk at the end, but you also state that test.test.*
is a no match.– Wiktor Stribiżew
Nov 27 '18 at 9:03
Could you clarify the criteria for your regex, please? It's not this obvious.
– reartnew
Nov 27 '18 at 9:03
Could you clarify the criteria for your regex, please? It's not this obvious.
– reartnew
Nov 27 '18 at 9:03
@WiktorStribiżew your regex is working. Please put is as answer and I will accept it.
– Dino
Nov 27 '18 at 9:06
@WiktorStribiżew your regex is working. Please put is as answer and I will accept it.
– Dino
Nov 27 '18 at 9:06
add a comment |
3 Answers
3
active
oldest
votes
You may use
^(?!.*[.*]{2})[a-z0-9*_:-]+(?:.[a-z0-9*_:-]+)+$
See the regex demo (at regexstorm, line endings are CRLF and r?
is used for the multiline string demo purpose only).
Details
^
- start of string
(?!.*[.*]{2})
- no two consecutive.
and*
are allowed
[a-z0-9*_:-]+
- 1 or more ASCII lowercase letters, digits,*
,_
,:
or-
(?:.[a-z0-9*_:-]+)+
- 1 or more consecutive occurrences of
.
- a dot
[a-z0-9*_:-]+
- 1 or more ASCII lowercase letters, digits,*
,_
,:
or-
$
- end of string.
2
@PushpeshKumarRajwanshi Let OP use it and we'll see. I can fix the pattern if OP comes back to adjust the requirements. I only posted since my suggestion worked.
– Wiktor Stribiżew
Nov 27 '18 at 10:52
3
@PushpeshKumarRajwanshi You will get upvotes if your answer is considered correct or helpful by others.
– Wiktor Stribiżew
Nov 27 '18 at 11:03
add a comment |
I think this will solve your problem.
^[a-z0-9]+.[a-z0-9]+((.[a-z0-9]+)|*)?$
Explanation
^
- Start of the string.
[a-z0-9]
- any of the character in this range will be valid.
+
- One or more.
.
- Matches literal . (period).
((.[a-z0-9]+)|*)?
-
(.[a-z0-9]+) - this sub-group checks for . followed by any digit or characters
* - matches for asterisk
? - make the preceding group optional.
$
- Anchor to the end of line
It checks for all the cases what user asked for. let the OP checks and come-up with requirements if it doesn't serve what he asked for. Am i supposed to write a regex which matches every pattern of world ? I think you should read the comments of again Wiktor @PushpeshKumarRajwanshi
– Code Maniac
Nov 29 '18 at 4:33
Well, OP didn't ask to write a regex that matches every pattern of world as that is trivial which is.*
OP was very clear in stating dot separated list andtest.test.test
is a simple dot separated list which should match. Even Wiktor's or mine answer also matches that simple text but yours doesn't match.
– Pushpesh Kumar Rajwanshi
Nov 29 '18 at 7:18
add a comment |
From your given valid and invalid sample of text, I am concluding following things,
- The text will contain word characters.
- The word characters can be separated by single dot. Like this
abc.xyz
oraaa.bbb.ccc
- Dot character can't be the first or last character. This is not ok
.abc
orabc.aaa.
- Optionally star (asterisk) character can only appear as the last character. Hence
test.text*
is fine becausetest.text
is fine buttest.text.*
is not fine becausetest.text.
is not fine.
Considering these rules, you can use following regex,
^w+(.w+)*(?<!.)[*]?$
Explanation:
^
--> Start of string
w+
--> match a word of one or more length
(.w+)*
--> Match further word characters zero or more preceded by a single literal dot zero or more times.
(?<!.)[*]?
--> asterisk character can optionally be present at the end of string which should not be preceded by a literal dot
$
--> End of input.
Demo
add a comment |
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
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53495945%2fregular-expression-to-match-dot-separated-list-with-no-dot-on-the-end-and-allow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You may use
^(?!.*[.*]{2})[a-z0-9*_:-]+(?:.[a-z0-9*_:-]+)+$
See the regex demo (at regexstorm, line endings are CRLF and r?
is used for the multiline string demo purpose only).
Details
^
- start of string
(?!.*[.*]{2})
- no two consecutive.
and*
are allowed
[a-z0-9*_:-]+
- 1 or more ASCII lowercase letters, digits,*
,_
,:
or-
(?:.[a-z0-9*_:-]+)+
- 1 or more consecutive occurrences of
.
- a dot
[a-z0-9*_:-]+
- 1 or more ASCII lowercase letters, digits,*
,_
,:
or-
$
- end of string.
2
@PushpeshKumarRajwanshi Let OP use it and we'll see. I can fix the pattern if OP comes back to adjust the requirements. I only posted since my suggestion worked.
– Wiktor Stribiżew
Nov 27 '18 at 10:52
3
@PushpeshKumarRajwanshi You will get upvotes if your answer is considered correct or helpful by others.
– Wiktor Stribiżew
Nov 27 '18 at 11:03
add a comment |
You may use
^(?!.*[.*]{2})[a-z0-9*_:-]+(?:.[a-z0-9*_:-]+)+$
See the regex demo (at regexstorm, line endings are CRLF and r?
is used for the multiline string demo purpose only).
Details
^
- start of string
(?!.*[.*]{2})
- no two consecutive.
and*
are allowed
[a-z0-9*_:-]+
- 1 or more ASCII lowercase letters, digits,*
,_
,:
or-
(?:.[a-z0-9*_:-]+)+
- 1 or more consecutive occurrences of
.
- a dot
[a-z0-9*_:-]+
- 1 or more ASCII lowercase letters, digits,*
,_
,:
or-
$
- end of string.
2
@PushpeshKumarRajwanshi Let OP use it and we'll see. I can fix the pattern if OP comes back to adjust the requirements. I only posted since my suggestion worked.
– Wiktor Stribiżew
Nov 27 '18 at 10:52
3
@PushpeshKumarRajwanshi You will get upvotes if your answer is considered correct or helpful by others.
– Wiktor Stribiżew
Nov 27 '18 at 11:03
add a comment |
You may use
^(?!.*[.*]{2})[a-z0-9*_:-]+(?:.[a-z0-9*_:-]+)+$
See the regex demo (at regexstorm, line endings are CRLF and r?
is used for the multiline string demo purpose only).
Details
^
- start of string
(?!.*[.*]{2})
- no two consecutive.
and*
are allowed
[a-z0-9*_:-]+
- 1 or more ASCII lowercase letters, digits,*
,_
,:
or-
(?:.[a-z0-9*_:-]+)+
- 1 or more consecutive occurrences of
.
- a dot
[a-z0-9*_:-]+
- 1 or more ASCII lowercase letters, digits,*
,_
,:
or-
$
- end of string.
You may use
^(?!.*[.*]{2})[a-z0-9*_:-]+(?:.[a-z0-9*_:-]+)+$
See the regex demo (at regexstorm, line endings are CRLF and r?
is used for the multiline string demo purpose only).
Details
^
- start of string
(?!.*[.*]{2})
- no two consecutive.
and*
are allowed
[a-z0-9*_:-]+
- 1 or more ASCII lowercase letters, digits,*
,_
,:
or-
(?:.[a-z0-9*_:-]+)+
- 1 or more consecutive occurrences of
.
- a dot
[a-z0-9*_:-]+
- 1 or more ASCII lowercase letters, digits,*
,_
,:
or-
$
- end of string.
edited Nov 27 '18 at 10:48
answered Nov 27 '18 at 9:09
Wiktor StribiżewWiktor Stribiżew
319k16140222
319k16140222
2
@PushpeshKumarRajwanshi Let OP use it and we'll see. I can fix the pattern if OP comes back to adjust the requirements. I only posted since my suggestion worked.
– Wiktor Stribiżew
Nov 27 '18 at 10:52
3
@PushpeshKumarRajwanshi You will get upvotes if your answer is considered correct or helpful by others.
– Wiktor Stribiżew
Nov 27 '18 at 11:03
add a comment |
2
@PushpeshKumarRajwanshi Let OP use it and we'll see. I can fix the pattern if OP comes back to adjust the requirements. I only posted since my suggestion worked.
– Wiktor Stribiżew
Nov 27 '18 at 10:52
3
@PushpeshKumarRajwanshi You will get upvotes if your answer is considered correct or helpful by others.
– Wiktor Stribiżew
Nov 27 '18 at 11:03
2
2
@PushpeshKumarRajwanshi Let OP use it and we'll see. I can fix the pattern if OP comes back to adjust the requirements. I only posted since my suggestion worked.
– Wiktor Stribiżew
Nov 27 '18 at 10:52
@PushpeshKumarRajwanshi Let OP use it and we'll see. I can fix the pattern if OP comes back to adjust the requirements. I only posted since my suggestion worked.
– Wiktor Stribiżew
Nov 27 '18 at 10:52
3
3
@PushpeshKumarRajwanshi You will get upvotes if your answer is considered correct or helpful by others.
– Wiktor Stribiżew
Nov 27 '18 at 11:03
@PushpeshKumarRajwanshi You will get upvotes if your answer is considered correct or helpful by others.
– Wiktor Stribiżew
Nov 27 '18 at 11:03
add a comment |
I think this will solve your problem.
^[a-z0-9]+.[a-z0-9]+((.[a-z0-9]+)|*)?$
Explanation
^
- Start of the string.
[a-z0-9]
- any of the character in this range will be valid.
+
- One or more.
.
- Matches literal . (period).
((.[a-z0-9]+)|*)?
-
(.[a-z0-9]+) - this sub-group checks for . followed by any digit or characters
* - matches for asterisk
? - make the preceding group optional.
$
- Anchor to the end of line
It checks for all the cases what user asked for. let the OP checks and come-up with requirements if it doesn't serve what he asked for. Am i supposed to write a regex which matches every pattern of world ? I think you should read the comments of again Wiktor @PushpeshKumarRajwanshi
– Code Maniac
Nov 29 '18 at 4:33
Well, OP didn't ask to write a regex that matches every pattern of world as that is trivial which is.*
OP was very clear in stating dot separated list andtest.test.test
is a simple dot separated list which should match. Even Wiktor's or mine answer also matches that simple text but yours doesn't match.
– Pushpesh Kumar Rajwanshi
Nov 29 '18 at 7:18
add a comment |
I think this will solve your problem.
^[a-z0-9]+.[a-z0-9]+((.[a-z0-9]+)|*)?$
Explanation
^
- Start of the string.
[a-z0-9]
- any of the character in this range will be valid.
+
- One or more.
.
- Matches literal . (period).
((.[a-z0-9]+)|*)?
-
(.[a-z0-9]+) - this sub-group checks for . followed by any digit or characters
* - matches for asterisk
? - make the preceding group optional.
$
- Anchor to the end of line
It checks for all the cases what user asked for. let the OP checks and come-up with requirements if it doesn't serve what he asked for. Am i supposed to write a regex which matches every pattern of world ? I think you should read the comments of again Wiktor @PushpeshKumarRajwanshi
– Code Maniac
Nov 29 '18 at 4:33
Well, OP didn't ask to write a regex that matches every pattern of world as that is trivial which is.*
OP was very clear in stating dot separated list andtest.test.test
is a simple dot separated list which should match. Even Wiktor's or mine answer also matches that simple text but yours doesn't match.
– Pushpesh Kumar Rajwanshi
Nov 29 '18 at 7:18
add a comment |
I think this will solve your problem.
^[a-z0-9]+.[a-z0-9]+((.[a-z0-9]+)|*)?$
Explanation
^
- Start of the string.
[a-z0-9]
- any of the character in this range will be valid.
+
- One or more.
.
- Matches literal . (period).
((.[a-z0-9]+)|*)?
-
(.[a-z0-9]+) - this sub-group checks for . followed by any digit or characters
* - matches for asterisk
? - make the preceding group optional.
$
- Anchor to the end of line
I think this will solve your problem.
^[a-z0-9]+.[a-z0-9]+((.[a-z0-9]+)|*)?$
Explanation
^
- Start of the string.
[a-z0-9]
- any of the character in this range will be valid.
+
- One or more.
.
- Matches literal . (period).
((.[a-z0-9]+)|*)?
-
(.[a-z0-9]+) - this sub-group checks for . followed by any digit or characters
* - matches for asterisk
? - make the preceding group optional.
$
- Anchor to the end of line
edited Nov 29 '18 at 12:56
answered Nov 27 '18 at 9:19
Code ManiacCode Maniac
7,5201526
7,5201526
It checks for all the cases what user asked for. let the OP checks and come-up with requirements if it doesn't serve what he asked for. Am i supposed to write a regex which matches every pattern of world ? I think you should read the comments of again Wiktor @PushpeshKumarRajwanshi
– Code Maniac
Nov 29 '18 at 4:33
Well, OP didn't ask to write a regex that matches every pattern of world as that is trivial which is.*
OP was very clear in stating dot separated list andtest.test.test
is a simple dot separated list which should match. Even Wiktor's or mine answer also matches that simple text but yours doesn't match.
– Pushpesh Kumar Rajwanshi
Nov 29 '18 at 7:18
add a comment |
It checks for all the cases what user asked for. let the OP checks and come-up with requirements if it doesn't serve what he asked for. Am i supposed to write a regex which matches every pattern of world ? I think you should read the comments of again Wiktor @PushpeshKumarRajwanshi
– Code Maniac
Nov 29 '18 at 4:33
Well, OP didn't ask to write a regex that matches every pattern of world as that is trivial which is.*
OP was very clear in stating dot separated list andtest.test.test
is a simple dot separated list which should match. Even Wiktor's or mine answer also matches that simple text but yours doesn't match.
– Pushpesh Kumar Rajwanshi
Nov 29 '18 at 7:18
It checks for all the cases what user asked for. let the OP checks and come-up with requirements if it doesn't serve what he asked for. Am i supposed to write a regex which matches every pattern of world ? I think you should read the comments of again Wiktor @PushpeshKumarRajwanshi
– Code Maniac
Nov 29 '18 at 4:33
It checks for all the cases what user asked for. let the OP checks and come-up with requirements if it doesn't serve what he asked for. Am i supposed to write a regex which matches every pattern of world ? I think you should read the comments of again Wiktor @PushpeshKumarRajwanshi
– Code Maniac
Nov 29 '18 at 4:33
Well, OP didn't ask to write a regex that matches every pattern of world as that is trivial which is
.*
OP was very clear in stating dot separated list and test.test.test
is a simple dot separated list which should match. Even Wiktor's or mine answer also matches that simple text but yours doesn't match.– Pushpesh Kumar Rajwanshi
Nov 29 '18 at 7:18
Well, OP didn't ask to write a regex that matches every pattern of world as that is trivial which is
.*
OP was very clear in stating dot separated list and test.test.test
is a simple dot separated list which should match. Even Wiktor's or mine answer also matches that simple text but yours doesn't match.– Pushpesh Kumar Rajwanshi
Nov 29 '18 at 7:18
add a comment |
From your given valid and invalid sample of text, I am concluding following things,
- The text will contain word characters.
- The word characters can be separated by single dot. Like this
abc.xyz
oraaa.bbb.ccc
- Dot character can't be the first or last character. This is not ok
.abc
orabc.aaa.
- Optionally star (asterisk) character can only appear as the last character. Hence
test.text*
is fine becausetest.text
is fine buttest.text.*
is not fine becausetest.text.
is not fine.
Considering these rules, you can use following regex,
^w+(.w+)*(?<!.)[*]?$
Explanation:
^
--> Start of string
w+
--> match a word of one or more length
(.w+)*
--> Match further word characters zero or more preceded by a single literal dot zero or more times.
(?<!.)[*]?
--> asterisk character can optionally be present at the end of string which should not be preceded by a literal dot
$
--> End of input.
Demo
add a comment |
From your given valid and invalid sample of text, I am concluding following things,
- The text will contain word characters.
- The word characters can be separated by single dot. Like this
abc.xyz
oraaa.bbb.ccc
- Dot character can't be the first or last character. This is not ok
.abc
orabc.aaa.
- Optionally star (asterisk) character can only appear as the last character. Hence
test.text*
is fine becausetest.text
is fine buttest.text.*
is not fine becausetest.text.
is not fine.
Considering these rules, you can use following regex,
^w+(.w+)*(?<!.)[*]?$
Explanation:
^
--> Start of string
w+
--> match a word of one or more length
(.w+)*
--> Match further word characters zero or more preceded by a single literal dot zero or more times.
(?<!.)[*]?
--> asterisk character can optionally be present at the end of string which should not be preceded by a literal dot
$
--> End of input.
Demo
add a comment |
From your given valid and invalid sample of text, I am concluding following things,
- The text will contain word characters.
- The word characters can be separated by single dot. Like this
abc.xyz
oraaa.bbb.ccc
- Dot character can't be the first or last character. This is not ok
.abc
orabc.aaa.
- Optionally star (asterisk) character can only appear as the last character. Hence
test.text*
is fine becausetest.text
is fine buttest.text.*
is not fine becausetest.text.
is not fine.
Considering these rules, you can use following regex,
^w+(.w+)*(?<!.)[*]?$
Explanation:
^
--> Start of string
w+
--> match a word of one or more length
(.w+)*
--> Match further word characters zero or more preceded by a single literal dot zero or more times.
(?<!.)[*]?
--> asterisk character can optionally be present at the end of string which should not be preceded by a literal dot
$
--> End of input.
Demo
From your given valid and invalid sample of text, I am concluding following things,
- The text will contain word characters.
- The word characters can be separated by single dot. Like this
abc.xyz
oraaa.bbb.ccc
- Dot character can't be the first or last character. This is not ok
.abc
orabc.aaa.
- Optionally star (asterisk) character can only appear as the last character. Hence
test.text*
is fine becausetest.text
is fine buttest.text.*
is not fine becausetest.text.
is not fine.
Considering these rules, you can use following regex,
^w+(.w+)*(?<!.)[*]?$
Explanation:
^
--> Start of string
w+
--> match a word of one or more length
(.w+)*
--> Match further word characters zero or more preceded by a single literal dot zero or more times.
(?<!.)[*]?
--> asterisk character can optionally be present at the end of string which should not be preceded by a literal dot
$
--> End of input.
Demo
answered Nov 27 '18 at 10:39
Pushpesh Kumar RajwanshiPushpesh Kumar Rajwanshi
8,53321027
8,53321027
add a comment |
add a comment |
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.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53495945%2fregular-expression-to-match-dot-separated-list-with-no-dot-on-the-end-and-allow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
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
What is the second regex? It is not quite clear what the rule related to
*
is. I tried now with^(?!.*[.*]{2})[a-z0-9*_:-]+(?:.[a-z0-9*_:-]+)+$
, no idea if you meant that.
and*
cannot appear next to each other (or consecutive.
and*
are not allowed). You say allow asterisk at the end, but you also state thattest.test.*
is a no match.– Wiktor Stribiżew
Nov 27 '18 at 9:03
Could you clarify the criteria for your regex, please? It's not this obvious.
– reartnew
Nov 27 '18 at 9:03
@WiktorStribiżew your regex is working. Please put is as answer and I will accept it.
– Dino
Nov 27 '18 at 9:06