Regular Expressions, understanding lookbehind in combination with the or operator
This is more a question of understanding than an actual problem. The situation explains as follows. I got some float numbers (e.g. an amount of money) between two quotation marks "".
Examples:
- "1,23"
- "12,23"
- "123,23"
Now I wanted to match the comma in those expressions. I built the following regex which works for me:
(?<="[0-9]|[0-9]{2})(,)(?=[0-9]{2}")
The part which I don't completly understand is the lookbehind in combination with the or "|". But let's break it up:
(
?<= //Start of the lookbehind
" //Starting with an escaped quotation mark "
[0-9] //Followed by a digit between 0 and 9
Now I had the problem, that after the quotation mark wasn't always just one digit as you can see in the examples 2 and 3. The range operator e.g. {1,3} did not work within the lookbehind. As I found out in another stackoverflow question.
So I decided to use the or "|" operator as sugested here:
|[0-9]{2} //Or followed by two digits between 0 and 9
)
The interesting part is that it also matches the comma in the third example "123,23". I don't really understand why.
Also I don't know why I don't have to add the starting quotation mark after the or "|" operator again, because I thought that the complete lookbehind until the or operator would be necessary to be modified or repeated e.g.:
(?<="[0-9]|"[0-9]{2})(,)(?=[0-9]{2}") //This however does not work at all
So in my understanding the corresponding regular expression to match all three examples should look like the following:
(?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
or at least (if someone can explain the missing "):
(?<="[0-9]|[0-9]{2}|[0-9]{3})(,)(?=[0-9]{2}")
I hope someone is able to help me understand the situation.
//Edit:
If it is of special interest, I used this regex in a regular textfile in the sublime text 3 editor, to search for the comma and replace it.
regex sublimetext3 regex-lookarounds
add a comment |
This is more a question of understanding than an actual problem. The situation explains as follows. I got some float numbers (e.g. an amount of money) between two quotation marks "".
Examples:
- "1,23"
- "12,23"
- "123,23"
Now I wanted to match the comma in those expressions. I built the following regex which works for me:
(?<="[0-9]|[0-9]{2})(,)(?=[0-9]{2}")
The part which I don't completly understand is the lookbehind in combination with the or "|". But let's break it up:
(
?<= //Start of the lookbehind
" //Starting with an escaped quotation mark "
[0-9] //Followed by a digit between 0 and 9
Now I had the problem, that after the quotation mark wasn't always just one digit as you can see in the examples 2 and 3. The range operator e.g. {1,3} did not work within the lookbehind. As I found out in another stackoverflow question.
So I decided to use the or "|" operator as sugested here:
|[0-9]{2} //Or followed by two digits between 0 and 9
)
The interesting part is that it also matches the comma in the third example "123,23". I don't really understand why.
Also I don't know why I don't have to add the starting quotation mark after the or "|" operator again, because I thought that the complete lookbehind until the or operator would be necessary to be modified or repeated e.g.:
(?<="[0-9]|"[0-9]{2})(,)(?=[0-9]{2}") //This however does not work at all
So in my understanding the corresponding regular expression to match all three examples should look like the following:
(?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
or at least (if someone can explain the missing "):
(?<="[0-9]|[0-9]{2}|[0-9]{3})(,)(?=[0-9]{2}")
I hope someone is able to help me understand the situation.
//Edit:
If it is of special interest, I used this regex in a regular textfile in the sublime text 3 editor, to search for the comma and replace it.
regex sublimetext3 regex-lookarounds
(?<="[0-9]|[0-9]{2})
matches all the commas in these examples
– wiktus239
Aug 7 '15 at 8:17
add a comment |
This is more a question of understanding than an actual problem. The situation explains as follows. I got some float numbers (e.g. an amount of money) between two quotation marks "".
Examples:
- "1,23"
- "12,23"
- "123,23"
Now I wanted to match the comma in those expressions. I built the following regex which works for me:
(?<="[0-9]|[0-9]{2})(,)(?=[0-9]{2}")
The part which I don't completly understand is the lookbehind in combination with the or "|". But let's break it up:
(
?<= //Start of the lookbehind
" //Starting with an escaped quotation mark "
[0-9] //Followed by a digit between 0 and 9
Now I had the problem, that after the quotation mark wasn't always just one digit as you can see in the examples 2 and 3. The range operator e.g. {1,3} did not work within the lookbehind. As I found out in another stackoverflow question.
So I decided to use the or "|" operator as sugested here:
|[0-9]{2} //Or followed by two digits between 0 and 9
)
The interesting part is that it also matches the comma in the third example "123,23". I don't really understand why.
Also I don't know why I don't have to add the starting quotation mark after the or "|" operator again, because I thought that the complete lookbehind until the or operator would be necessary to be modified or repeated e.g.:
(?<="[0-9]|"[0-9]{2})(,)(?=[0-9]{2}") //This however does not work at all
So in my understanding the corresponding regular expression to match all three examples should look like the following:
(?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
or at least (if someone can explain the missing "):
(?<="[0-9]|[0-9]{2}|[0-9]{3})(,)(?=[0-9]{2}")
I hope someone is able to help me understand the situation.
//Edit:
If it is of special interest, I used this regex in a regular textfile in the sublime text 3 editor, to search for the comma and replace it.
regex sublimetext3 regex-lookarounds
This is more a question of understanding than an actual problem. The situation explains as follows. I got some float numbers (e.g. an amount of money) between two quotation marks "".
Examples:
- "1,23"
- "12,23"
- "123,23"
Now I wanted to match the comma in those expressions. I built the following regex which works for me:
(?<="[0-9]|[0-9]{2})(,)(?=[0-9]{2}")
The part which I don't completly understand is the lookbehind in combination with the or "|". But let's break it up:
(
?<= //Start of the lookbehind
" //Starting with an escaped quotation mark "
[0-9] //Followed by a digit between 0 and 9
Now I had the problem, that after the quotation mark wasn't always just one digit as you can see in the examples 2 and 3. The range operator e.g. {1,3} did not work within the lookbehind. As I found out in another stackoverflow question.
So I decided to use the or "|" operator as sugested here:
|[0-9]{2} //Or followed by two digits between 0 and 9
)
The interesting part is that it also matches the comma in the third example "123,23". I don't really understand why.
Also I don't know why I don't have to add the starting quotation mark after the or "|" operator again, because I thought that the complete lookbehind until the or operator would be necessary to be modified or repeated e.g.:
(?<="[0-9]|"[0-9]{2})(,)(?=[0-9]{2}") //This however does not work at all
So in my understanding the corresponding regular expression to match all three examples should look like the following:
(?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
or at least (if someone can explain the missing "):
(?<="[0-9]|[0-9]{2}|[0-9]{3})(,)(?=[0-9]{2}")
I hope someone is able to help me understand the situation.
//Edit:
If it is of special interest, I used this regex in a regular textfile in the sublime text 3 editor, to search for the comma and replace it.
regex sublimetext3 regex-lookarounds
regex sublimetext3 regex-lookarounds
edited May 23 '17 at 10:27
Community♦
11
11
asked Aug 7 '15 at 7:53
KevinKevin
16317
16317
(?<="[0-9]|[0-9]{2})
matches all the commas in these examples
– wiktus239
Aug 7 '15 at 8:17
add a comment |
(?<="[0-9]|[0-9]{2})
matches all the commas in these examples
– wiktus239
Aug 7 '15 at 8:17
(?<="[0-9]|[0-9]{2})
matches all the commas in these examples– wiktus239
Aug 7 '15 at 8:17
(?<="[0-9]|[0-9]{2})
matches all the commas in these examples– wiktus239
Aug 7 '15 at 8:17
add a comment |
1 Answer
1
active
oldest
votes
You are correct,
(?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
should be the right regex in this case.
About why you "don't need the
"
for two and three digits" - you actually need it.(?<="[0-9]|[0-9]{2}|[0-9]{3})(,)(?=[0-9]{2}")
Will match 12,23"
and 123,23"
as well.
EDIT:
Looks like the problem is that Sublime doesn't allow for variable length of lookbehind even if they are listed with
|
. Meaning (?<="[0-9]|"[0-9]{2}|"[0-9]{3})
will fail, because the alternatives are not of the same size - 2, 3, 4.This is because Sublime seems to be using the Boost library regexes. There it is stated:
Lookbehind
(?<=pattern)
consumes zero characters, only if pattern could be matched against the characters preceding the current position (pattern must be of fixed length).
(?<!pattern)
consumes zero characters, only if pattern could not be matched against the characters preceding the current position (pattern must be of fixed length).
An alternative is to separate the lookbehinds:
(?:(?<="[0-9])|(?<="[0-9]{2})|(?<="[0-9]{3}))(,)(?=[0-9]{2}")
What can you do if you don't want to list all possible lengths?
There is a cool trick which is present in some regex engines (including Perl's, Ruby's and Sublime's) - K
. What K
roughly translates to is "drop all that was matched so far". Therefore, you can match any ,
within a float number surrounded by quotation marks with:
"d+K,(?=d+")
See it in action
Well I mean that sublime text does not accept(?<="[0-9]|"[0-9]{2})(,)(?=[0-9]{2}")
and says the following error: "Invalid lookbehind assertion encountered in the regular expression", same with(?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
. But yes"d+K,(?=d+")
works just fine for that specific case. Thank you for that. Maybe it's just a problem of sublime text and not a problem of the regex itself?
– Kevin
Aug 7 '15 at 8:17
I managed to reproduce it and updated my answer.
– ndnenkov
Aug 7 '15 at 8:27
If it's just a problem of sublime text, I can live with that. Thank you very much for this anwser. It helped my understanding a lot.
– Kevin
Aug 7 '15 at 8:35
I did some further investigation and updated my answer to explain why Sublime has this limitation and how you can work around it.
– ndnenkov
Aug 7 '15 at 9:13
Again, thank you for your effort. I really appreciate it.
– Kevin
Aug 7 '15 at 9:16
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%2f31872392%2fregular-expressions-understanding-lookbehind-in-combination-with-the-or-operato%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are correct,
(?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
should be the right regex in this case.
About why you "don't need the
"
for two and three digits" - you actually need it.(?<="[0-9]|[0-9]{2}|[0-9]{3})(,)(?=[0-9]{2}")
Will match 12,23"
and 123,23"
as well.
EDIT:
Looks like the problem is that Sublime doesn't allow for variable length of lookbehind even if they are listed with
|
. Meaning (?<="[0-9]|"[0-9]{2}|"[0-9]{3})
will fail, because the alternatives are not of the same size - 2, 3, 4.This is because Sublime seems to be using the Boost library regexes. There it is stated:
Lookbehind
(?<=pattern)
consumes zero characters, only if pattern could be matched against the characters preceding the current position (pattern must be of fixed length).
(?<!pattern)
consumes zero characters, only if pattern could not be matched against the characters preceding the current position (pattern must be of fixed length).
An alternative is to separate the lookbehinds:
(?:(?<="[0-9])|(?<="[0-9]{2})|(?<="[0-9]{3}))(,)(?=[0-9]{2}")
What can you do if you don't want to list all possible lengths?
There is a cool trick which is present in some regex engines (including Perl's, Ruby's and Sublime's) - K
. What K
roughly translates to is "drop all that was matched so far". Therefore, you can match any ,
within a float number surrounded by quotation marks with:
"d+K,(?=d+")
See it in action
Well I mean that sublime text does not accept(?<="[0-9]|"[0-9]{2})(,)(?=[0-9]{2}")
and says the following error: "Invalid lookbehind assertion encountered in the regular expression", same with(?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
. But yes"d+K,(?=d+")
works just fine for that specific case. Thank you for that. Maybe it's just a problem of sublime text and not a problem of the regex itself?
– Kevin
Aug 7 '15 at 8:17
I managed to reproduce it and updated my answer.
– ndnenkov
Aug 7 '15 at 8:27
If it's just a problem of sublime text, I can live with that. Thank you very much for this anwser. It helped my understanding a lot.
– Kevin
Aug 7 '15 at 8:35
I did some further investigation and updated my answer to explain why Sublime has this limitation and how you can work around it.
– ndnenkov
Aug 7 '15 at 9:13
Again, thank you for your effort. I really appreciate it.
– Kevin
Aug 7 '15 at 9:16
add a comment |
You are correct,
(?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
should be the right regex in this case.
About why you "don't need the
"
for two and three digits" - you actually need it.(?<="[0-9]|[0-9]{2}|[0-9]{3})(,)(?=[0-9]{2}")
Will match 12,23"
and 123,23"
as well.
EDIT:
Looks like the problem is that Sublime doesn't allow for variable length of lookbehind even if they are listed with
|
. Meaning (?<="[0-9]|"[0-9]{2}|"[0-9]{3})
will fail, because the alternatives are not of the same size - 2, 3, 4.This is because Sublime seems to be using the Boost library regexes. There it is stated:
Lookbehind
(?<=pattern)
consumes zero characters, only if pattern could be matched against the characters preceding the current position (pattern must be of fixed length).
(?<!pattern)
consumes zero characters, only if pattern could not be matched against the characters preceding the current position (pattern must be of fixed length).
An alternative is to separate the lookbehinds:
(?:(?<="[0-9])|(?<="[0-9]{2})|(?<="[0-9]{3}))(,)(?=[0-9]{2}")
What can you do if you don't want to list all possible lengths?
There is a cool trick which is present in some regex engines (including Perl's, Ruby's and Sublime's) - K
. What K
roughly translates to is "drop all that was matched so far". Therefore, you can match any ,
within a float number surrounded by quotation marks with:
"d+K,(?=d+")
See it in action
Well I mean that sublime text does not accept(?<="[0-9]|"[0-9]{2})(,)(?=[0-9]{2}")
and says the following error: "Invalid lookbehind assertion encountered in the regular expression", same with(?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
. But yes"d+K,(?=d+")
works just fine for that specific case. Thank you for that. Maybe it's just a problem of sublime text and not a problem of the regex itself?
– Kevin
Aug 7 '15 at 8:17
I managed to reproduce it and updated my answer.
– ndnenkov
Aug 7 '15 at 8:27
If it's just a problem of sublime text, I can live with that. Thank you very much for this anwser. It helped my understanding a lot.
– Kevin
Aug 7 '15 at 8:35
I did some further investigation and updated my answer to explain why Sublime has this limitation and how you can work around it.
– ndnenkov
Aug 7 '15 at 9:13
Again, thank you for your effort. I really appreciate it.
– Kevin
Aug 7 '15 at 9:16
add a comment |
You are correct,
(?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
should be the right regex in this case.
About why you "don't need the
"
for two and three digits" - you actually need it.(?<="[0-9]|[0-9]{2}|[0-9]{3})(,)(?=[0-9]{2}")
Will match 12,23"
and 123,23"
as well.
EDIT:
Looks like the problem is that Sublime doesn't allow for variable length of lookbehind even if they are listed with
|
. Meaning (?<="[0-9]|"[0-9]{2}|"[0-9]{3})
will fail, because the alternatives are not of the same size - 2, 3, 4.This is because Sublime seems to be using the Boost library regexes. There it is stated:
Lookbehind
(?<=pattern)
consumes zero characters, only if pattern could be matched against the characters preceding the current position (pattern must be of fixed length).
(?<!pattern)
consumes zero characters, only if pattern could not be matched against the characters preceding the current position (pattern must be of fixed length).
An alternative is to separate the lookbehinds:
(?:(?<="[0-9])|(?<="[0-9]{2})|(?<="[0-9]{3}))(,)(?=[0-9]{2}")
What can you do if you don't want to list all possible lengths?
There is a cool trick which is present in some regex engines (including Perl's, Ruby's and Sublime's) - K
. What K
roughly translates to is "drop all that was matched so far". Therefore, you can match any ,
within a float number surrounded by quotation marks with:
"d+K,(?=d+")
See it in action
You are correct,
(?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
should be the right regex in this case.
About why you "don't need the
"
for two and three digits" - you actually need it.(?<="[0-9]|[0-9]{2}|[0-9]{3})(,)(?=[0-9]{2}")
Will match 12,23"
and 123,23"
as well.
EDIT:
Looks like the problem is that Sublime doesn't allow for variable length of lookbehind even if they are listed with
|
. Meaning (?<="[0-9]|"[0-9]{2}|"[0-9]{3})
will fail, because the alternatives are not of the same size - 2, 3, 4.This is because Sublime seems to be using the Boost library regexes. There it is stated:
Lookbehind
(?<=pattern)
consumes zero characters, only if pattern could be matched against the characters preceding the current position (pattern must be of fixed length).
(?<!pattern)
consumes zero characters, only if pattern could not be matched against the characters preceding the current position (pattern must be of fixed length).
An alternative is to separate the lookbehinds:
(?:(?<="[0-9])|(?<="[0-9]{2})|(?<="[0-9]{3}))(,)(?=[0-9]{2}")
What can you do if you don't want to list all possible lengths?
There is a cool trick which is present in some regex engines (including Perl's, Ruby's and Sublime's) - K
. What K
roughly translates to is "drop all that was matched so far". Therefore, you can match any ,
within a float number surrounded by quotation marks with:
"d+K,(?=d+")
See it in action
edited Aug 7 '15 at 9:10
answered Aug 7 '15 at 8:09
ndnenkovndnenkov
28k74879
28k74879
Well I mean that sublime text does not accept(?<="[0-9]|"[0-9]{2})(,)(?=[0-9]{2}")
and says the following error: "Invalid lookbehind assertion encountered in the regular expression", same with(?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
. But yes"d+K,(?=d+")
works just fine for that specific case. Thank you for that. Maybe it's just a problem of sublime text and not a problem of the regex itself?
– Kevin
Aug 7 '15 at 8:17
I managed to reproduce it and updated my answer.
– ndnenkov
Aug 7 '15 at 8:27
If it's just a problem of sublime text, I can live with that. Thank you very much for this anwser. It helped my understanding a lot.
– Kevin
Aug 7 '15 at 8:35
I did some further investigation and updated my answer to explain why Sublime has this limitation and how you can work around it.
– ndnenkov
Aug 7 '15 at 9:13
Again, thank you for your effort. I really appreciate it.
– Kevin
Aug 7 '15 at 9:16
add a comment |
Well I mean that sublime text does not accept(?<="[0-9]|"[0-9]{2})(,)(?=[0-9]{2}")
and says the following error: "Invalid lookbehind assertion encountered in the regular expression", same with(?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
. But yes"d+K,(?=d+")
works just fine for that specific case. Thank you for that. Maybe it's just a problem of sublime text and not a problem of the regex itself?
– Kevin
Aug 7 '15 at 8:17
I managed to reproduce it and updated my answer.
– ndnenkov
Aug 7 '15 at 8:27
If it's just a problem of sublime text, I can live with that. Thank you very much for this anwser. It helped my understanding a lot.
– Kevin
Aug 7 '15 at 8:35
I did some further investigation and updated my answer to explain why Sublime has this limitation and how you can work around it.
– ndnenkov
Aug 7 '15 at 9:13
Again, thank you for your effort. I really appreciate it.
– Kevin
Aug 7 '15 at 9:16
Well I mean that sublime text does not accept
(?<="[0-9]|"[0-9]{2})(,)(?=[0-9]{2}")
and says the following error: "Invalid lookbehind assertion encountered in the regular expression", same with (?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
. But yes "d+K,(?=d+")
works just fine for that specific case. Thank you for that. Maybe it's just a problem of sublime text and not a problem of the regex itself?– Kevin
Aug 7 '15 at 8:17
Well I mean that sublime text does not accept
(?<="[0-9]|"[0-9]{2})(,)(?=[0-9]{2}")
and says the following error: "Invalid lookbehind assertion encountered in the regular expression", same with (?<="[0-9]|"[0-9]{2}|"[0-9]{3})(,)(?=[0-9]{2}")
. But yes "d+K,(?=d+")
works just fine for that specific case. Thank you for that. Maybe it's just a problem of sublime text and not a problem of the regex itself?– Kevin
Aug 7 '15 at 8:17
I managed to reproduce it and updated my answer.
– ndnenkov
Aug 7 '15 at 8:27
I managed to reproduce it and updated my answer.
– ndnenkov
Aug 7 '15 at 8:27
If it's just a problem of sublime text, I can live with that. Thank you very much for this anwser. It helped my understanding a lot.
– Kevin
Aug 7 '15 at 8:35
If it's just a problem of sublime text, I can live with that. Thank you very much for this anwser. It helped my understanding a lot.
– Kevin
Aug 7 '15 at 8:35
I did some further investigation and updated my answer to explain why Sublime has this limitation and how you can work around it.
– ndnenkov
Aug 7 '15 at 9:13
I did some further investigation and updated my answer to explain why Sublime has this limitation and how you can work around it.
– ndnenkov
Aug 7 '15 at 9:13
Again, thank you for your effort. I really appreciate it.
– Kevin
Aug 7 '15 at 9:16
Again, thank you for your effort. I really appreciate it.
– Kevin
Aug 7 '15 at 9:16
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%2f31872392%2fregular-expressions-understanding-lookbehind-in-combination-with-the-or-operato%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
(?<="[0-9]|[0-9]{2})
matches all the commas in these examples– wiktus239
Aug 7 '15 at 8:17