Regular expression for a hexadecimal number?
How do I create a regular expression that detects hexadecimal numbers in a text?
For example, ‘0x0f4’, ‘0acdadecf822eeff32aca5830e438cb54aa722e3’, and ‘8BADF00D’.
regex
add a comment |
How do I create a regular expression that detects hexadecimal numbers in a text?
For example, ‘0x0f4’, ‘0acdadecf822eeff32aca5830e438cb54aa722e3’, and ‘8BADF00D’.
regex
1
Regex doesn't really parse. Try extracting all number-like things and sift out the ones that aren't hexadecimals.
– Blender
Feb 10 '12 at 1:10
add a comment |
How do I create a regular expression that detects hexadecimal numbers in a text?
For example, ‘0x0f4’, ‘0acdadecf822eeff32aca5830e438cb54aa722e3’, and ‘8BADF00D’.
regex
How do I create a regular expression that detects hexadecimal numbers in a text?
For example, ‘0x0f4’, ‘0acdadecf822eeff32aca5830e438cb54aa722e3’, and ‘8BADF00D’.
regex
regex
edited Aug 15 '16 at 14:07
Peter Mortensen
13.5k1983111
13.5k1983111
asked Feb 10 '12 at 1:06
saurcerysaurcery
7211710
7211710
1
Regex doesn't really parse. Try extracting all number-like things and sift out the ones that aren't hexadecimals.
– Blender
Feb 10 '12 at 1:10
add a comment |
1
Regex doesn't really parse. Try extracting all number-like things and sift out the ones that aren't hexadecimals.
– Blender
Feb 10 '12 at 1:10
1
1
Regex doesn't really parse. Try extracting all number-like things and sift out the ones that aren't hexadecimals.
– Blender
Feb 10 '12 at 1:10
Regex doesn't really parse. Try extracting all number-like things and sift out the ones that aren't hexadecimals.
– Blender
Feb 10 '12 at 1:10
add a comment |
9 Answers
9
active
oldest
votes
How about the following?
0[xX][0-9a-fA-F]+
Matches expression starting with a 0, following by either a lower or uppercase x, followed by one or more characters in the ranges 0-9, or a-f, or A-F
25
That could be shortified to/0x[da-f]/i
, but otherwise, +1.
– Niklas B.
Feb 10 '12 at 1:13
12
@NiklasB. Your shorthand is only valid if using perl regex, if using POSIX regex, then Steven's solution is the shortest. Either way, Steven's solution works for both perl and POSIX regex.
– David M. Syzdek
Feb 10 '12 at 1:39
Got it! Solution by Steven is good if the hex number starts with 0x or 0X. This one should work better: ^[0-9A-F]+$ It can also recognize hex patterns like: '535GH0G73' For Java, we can use e.g String.matches() for checking this.. Thank you guys for the response :)
– saurcery
Feb 10 '12 at 2:23
2
'0x[da-f]{2}' propaply better to limit the number too
– Yazan Rawashdeh
Apr 11 '16 at 12:54
2
Would that match the second and third example numbers, 0acdadecf822eeff32aca5830e438cb54aa722e3 and 8BADF00D?
– Peter Mortensen
Aug 11 '16 at 12:34
add a comment |
The exact syntax depends on your exact requirements and programming language, but basically:
/[0-9a-fA-F]+/
or more simply, i
makes it case-insensitive.
/[0-9a-f]+/i
If you are lucky enough to be using Ruby, you can do:
/h+/
EDIT - Steven Schroeder's answer made me realise my understanding of the 0x bit was wrong, so I've updated my suggestions accordingly.
If you also want to match 0x, the equivalents are
/0[xX][0-9a-fA-F]+/
/0x[0-9a-f]+/i
/0x[h]+/i
ADDED MORE - If 0x needs to be optional (as the question implies):
/(0x)?[0-9a-f]+/i
can you explain me the reason for above RE?
– saurcery
Feb 10 '12 at 1:16
3
@noobDroid What specifically would you like me to explain?
– SimonMayer
Feb 10 '12 at 1:19
add a comment |
Not a big deal, but most regex engines support the POSIX character classes, and there's [:xdigit:]
for matching hex characters, which is simpler than the common 0-9a-fA-F
stuff.
So, the regex as requested (ie. with optional 0x
) is: /(0x)?[[:xdigit:]]+/
add a comment |
This will match with or without 0x
prefix
(?:0[xX])?[0-9a-fA-F]+
add a comment |
It's worth mentioning that detecting an MD5 (which is one of the examples) can be done with:
[0-9a-fA-F]{32}
add a comment |
If you're using Perl or PHP, you can replace
[0-9a-fA-F]
with:
[[:xdigit:]]
This ought to be a self-contained answer.
– Peter Mortensen
Aug 15 '16 at 14:10
add a comment |
Just for the record I would specify the following:
/^[xX]?[0-9a-fA-F]{6}$/
Which differs in that it checks that it has to contain the six valid characters and on lowercase or uppercase x in case we have one.
add a comment |
This one makes sure you have no more than three valid pairs:
(([a-fA-F]|[0-9]){2}){3}
Any more or less than three pairs of valid characters fail to match.
add a comment |
If you are looking for an specific hex character in the middle of the string, you can use "xhh" where hh is the character in hexadecimal. I've tried and it works. I use framework for C++ Qt but it can solve problems in other cases, depends on the flavor you need to use (php, javascript, python , golang, etc.).
This answer was taken from:http://ult-tex.net/info/perl/
Hey! While this might be true for perl, it doesn't seem to be the case for Regular Expressions in all programming languages. According to thisx
is the equivalent tou
in other languages.
– Maurice
Jan 2 '17 at 16:07
What is "especific anda"?
– Peter Mortensen
Sep 25 '17 at 12:19
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%2f9221362%2fregular-expression-for-a-hexadecimal-number%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
9 Answers
9
active
oldest
votes
9 Answers
9
active
oldest
votes
active
oldest
votes
active
oldest
votes
How about the following?
0[xX][0-9a-fA-F]+
Matches expression starting with a 0, following by either a lower or uppercase x, followed by one or more characters in the ranges 0-9, or a-f, or A-F
25
That could be shortified to/0x[da-f]/i
, but otherwise, +1.
– Niklas B.
Feb 10 '12 at 1:13
12
@NiklasB. Your shorthand is only valid if using perl regex, if using POSIX regex, then Steven's solution is the shortest. Either way, Steven's solution works for both perl and POSIX regex.
– David M. Syzdek
Feb 10 '12 at 1:39
Got it! Solution by Steven is good if the hex number starts with 0x or 0X. This one should work better: ^[0-9A-F]+$ It can also recognize hex patterns like: '535GH0G73' For Java, we can use e.g String.matches() for checking this.. Thank you guys for the response :)
– saurcery
Feb 10 '12 at 2:23
2
'0x[da-f]{2}' propaply better to limit the number too
– Yazan Rawashdeh
Apr 11 '16 at 12:54
2
Would that match the second and third example numbers, 0acdadecf822eeff32aca5830e438cb54aa722e3 and 8BADF00D?
– Peter Mortensen
Aug 11 '16 at 12:34
add a comment |
How about the following?
0[xX][0-9a-fA-F]+
Matches expression starting with a 0, following by either a lower or uppercase x, followed by one or more characters in the ranges 0-9, or a-f, or A-F
25
That could be shortified to/0x[da-f]/i
, but otherwise, +1.
– Niklas B.
Feb 10 '12 at 1:13
12
@NiklasB. Your shorthand is only valid if using perl regex, if using POSIX regex, then Steven's solution is the shortest. Either way, Steven's solution works for both perl and POSIX regex.
– David M. Syzdek
Feb 10 '12 at 1:39
Got it! Solution by Steven is good if the hex number starts with 0x or 0X. This one should work better: ^[0-9A-F]+$ It can also recognize hex patterns like: '535GH0G73' For Java, we can use e.g String.matches() for checking this.. Thank you guys for the response :)
– saurcery
Feb 10 '12 at 2:23
2
'0x[da-f]{2}' propaply better to limit the number too
– Yazan Rawashdeh
Apr 11 '16 at 12:54
2
Would that match the second and third example numbers, 0acdadecf822eeff32aca5830e438cb54aa722e3 and 8BADF00D?
– Peter Mortensen
Aug 11 '16 at 12:34
add a comment |
How about the following?
0[xX][0-9a-fA-F]+
Matches expression starting with a 0, following by either a lower or uppercase x, followed by one or more characters in the ranges 0-9, or a-f, or A-F
How about the following?
0[xX][0-9a-fA-F]+
Matches expression starting with a 0, following by either a lower or uppercase x, followed by one or more characters in the ranges 0-9, or a-f, or A-F
answered Feb 10 '12 at 1:10
Steven SchroederSteven Schroeder
3,86611515
3,86611515
25
That could be shortified to/0x[da-f]/i
, but otherwise, +1.
– Niklas B.
Feb 10 '12 at 1:13
12
@NiklasB. Your shorthand is only valid if using perl regex, if using POSIX regex, then Steven's solution is the shortest. Either way, Steven's solution works for both perl and POSIX regex.
– David M. Syzdek
Feb 10 '12 at 1:39
Got it! Solution by Steven is good if the hex number starts with 0x or 0X. This one should work better: ^[0-9A-F]+$ It can also recognize hex patterns like: '535GH0G73' For Java, we can use e.g String.matches() for checking this.. Thank you guys for the response :)
– saurcery
Feb 10 '12 at 2:23
2
'0x[da-f]{2}' propaply better to limit the number too
– Yazan Rawashdeh
Apr 11 '16 at 12:54
2
Would that match the second and third example numbers, 0acdadecf822eeff32aca5830e438cb54aa722e3 and 8BADF00D?
– Peter Mortensen
Aug 11 '16 at 12:34
add a comment |
25
That could be shortified to/0x[da-f]/i
, but otherwise, +1.
– Niklas B.
Feb 10 '12 at 1:13
12
@NiklasB. Your shorthand is only valid if using perl regex, if using POSIX regex, then Steven's solution is the shortest. Either way, Steven's solution works for both perl and POSIX regex.
– David M. Syzdek
Feb 10 '12 at 1:39
Got it! Solution by Steven is good if the hex number starts with 0x or 0X. This one should work better: ^[0-9A-F]+$ It can also recognize hex patterns like: '535GH0G73' For Java, we can use e.g String.matches() for checking this.. Thank you guys for the response :)
– saurcery
Feb 10 '12 at 2:23
2
'0x[da-f]{2}' propaply better to limit the number too
– Yazan Rawashdeh
Apr 11 '16 at 12:54
2
Would that match the second and third example numbers, 0acdadecf822eeff32aca5830e438cb54aa722e3 and 8BADF00D?
– Peter Mortensen
Aug 11 '16 at 12:34
25
25
That could be shortified to
/0x[da-f]/i
, but otherwise, +1.– Niklas B.
Feb 10 '12 at 1:13
That could be shortified to
/0x[da-f]/i
, but otherwise, +1.– Niklas B.
Feb 10 '12 at 1:13
12
12
@NiklasB. Your shorthand is only valid if using perl regex, if using POSIX regex, then Steven's solution is the shortest. Either way, Steven's solution works for both perl and POSIX regex.
– David M. Syzdek
Feb 10 '12 at 1:39
@NiklasB. Your shorthand is only valid if using perl regex, if using POSIX regex, then Steven's solution is the shortest. Either way, Steven's solution works for both perl and POSIX regex.
– David M. Syzdek
Feb 10 '12 at 1:39
Got it! Solution by Steven is good if the hex number starts with 0x or 0X. This one should work better: ^[0-9A-F]+$ It can also recognize hex patterns like: '535GH0G73' For Java, we can use e.g String.matches() for checking this.. Thank you guys for the response :)
– saurcery
Feb 10 '12 at 2:23
Got it! Solution by Steven is good if the hex number starts with 0x or 0X. This one should work better: ^[0-9A-F]+$ It can also recognize hex patterns like: '535GH0G73' For Java, we can use e.g String.matches() for checking this.. Thank you guys for the response :)
– saurcery
Feb 10 '12 at 2:23
2
2
'0x[da-f]{2}' propaply better to limit the number too
– Yazan Rawashdeh
Apr 11 '16 at 12:54
'0x[da-f]{2}' propaply better to limit the number too
– Yazan Rawashdeh
Apr 11 '16 at 12:54
2
2
Would that match the second and third example numbers, 0acdadecf822eeff32aca5830e438cb54aa722e3 and 8BADF00D?
– Peter Mortensen
Aug 11 '16 at 12:34
Would that match the second and third example numbers, 0acdadecf822eeff32aca5830e438cb54aa722e3 and 8BADF00D?
– Peter Mortensen
Aug 11 '16 at 12:34
add a comment |
The exact syntax depends on your exact requirements and programming language, but basically:
/[0-9a-fA-F]+/
or more simply, i
makes it case-insensitive.
/[0-9a-f]+/i
If you are lucky enough to be using Ruby, you can do:
/h+/
EDIT - Steven Schroeder's answer made me realise my understanding of the 0x bit was wrong, so I've updated my suggestions accordingly.
If you also want to match 0x, the equivalents are
/0[xX][0-9a-fA-F]+/
/0x[0-9a-f]+/i
/0x[h]+/i
ADDED MORE - If 0x needs to be optional (as the question implies):
/(0x)?[0-9a-f]+/i
can you explain me the reason for above RE?
– saurcery
Feb 10 '12 at 1:16
3
@noobDroid What specifically would you like me to explain?
– SimonMayer
Feb 10 '12 at 1:19
add a comment |
The exact syntax depends on your exact requirements and programming language, but basically:
/[0-9a-fA-F]+/
or more simply, i
makes it case-insensitive.
/[0-9a-f]+/i
If you are lucky enough to be using Ruby, you can do:
/h+/
EDIT - Steven Schroeder's answer made me realise my understanding of the 0x bit was wrong, so I've updated my suggestions accordingly.
If you also want to match 0x, the equivalents are
/0[xX][0-9a-fA-F]+/
/0x[0-9a-f]+/i
/0x[h]+/i
ADDED MORE - If 0x needs to be optional (as the question implies):
/(0x)?[0-9a-f]+/i
can you explain me the reason for above RE?
– saurcery
Feb 10 '12 at 1:16
3
@noobDroid What specifically would you like me to explain?
– SimonMayer
Feb 10 '12 at 1:19
add a comment |
The exact syntax depends on your exact requirements and programming language, but basically:
/[0-9a-fA-F]+/
or more simply, i
makes it case-insensitive.
/[0-9a-f]+/i
If you are lucky enough to be using Ruby, you can do:
/h+/
EDIT - Steven Schroeder's answer made me realise my understanding of the 0x bit was wrong, so I've updated my suggestions accordingly.
If you also want to match 0x, the equivalents are
/0[xX][0-9a-fA-F]+/
/0x[0-9a-f]+/i
/0x[h]+/i
ADDED MORE - If 0x needs to be optional (as the question implies):
/(0x)?[0-9a-f]+/i
The exact syntax depends on your exact requirements and programming language, but basically:
/[0-9a-fA-F]+/
or more simply, i
makes it case-insensitive.
/[0-9a-f]+/i
If you are lucky enough to be using Ruby, you can do:
/h+/
EDIT - Steven Schroeder's answer made me realise my understanding of the 0x bit was wrong, so I've updated my suggestions accordingly.
If you also want to match 0x, the equivalents are
/0[xX][0-9a-fA-F]+/
/0x[0-9a-f]+/i
/0x[h]+/i
ADDED MORE - If 0x needs to be optional (as the question implies):
/(0x)?[0-9a-f]+/i
edited Feb 10 '12 at 1:40
answered Feb 10 '12 at 1:11
SimonMayerSimonMayer
3,09622335
3,09622335
can you explain me the reason for above RE?
– saurcery
Feb 10 '12 at 1:16
3
@noobDroid What specifically would you like me to explain?
– SimonMayer
Feb 10 '12 at 1:19
add a comment |
can you explain me the reason for above RE?
– saurcery
Feb 10 '12 at 1:16
3
@noobDroid What specifically would you like me to explain?
– SimonMayer
Feb 10 '12 at 1:19
can you explain me the reason for above RE?
– saurcery
Feb 10 '12 at 1:16
can you explain me the reason for above RE?
– saurcery
Feb 10 '12 at 1:16
3
3
@noobDroid What specifically would you like me to explain?
– SimonMayer
Feb 10 '12 at 1:19
@noobDroid What specifically would you like me to explain?
– SimonMayer
Feb 10 '12 at 1:19
add a comment |
Not a big deal, but most regex engines support the POSIX character classes, and there's [:xdigit:]
for matching hex characters, which is simpler than the common 0-9a-fA-F
stuff.
So, the regex as requested (ie. with optional 0x
) is: /(0x)?[[:xdigit:]]+/
add a comment |
Not a big deal, but most regex engines support the POSIX character classes, and there's [:xdigit:]
for matching hex characters, which is simpler than the common 0-9a-fA-F
stuff.
So, the regex as requested (ie. with optional 0x
) is: /(0x)?[[:xdigit:]]+/
add a comment |
Not a big deal, but most regex engines support the POSIX character classes, and there's [:xdigit:]
for matching hex characters, which is simpler than the common 0-9a-fA-F
stuff.
So, the regex as requested (ie. with optional 0x
) is: /(0x)?[[:xdigit:]]+/
Not a big deal, but most regex engines support the POSIX character classes, and there's [:xdigit:]
for matching hex characters, which is simpler than the common 0-9a-fA-F
stuff.
So, the regex as requested (ie. with optional 0x
) is: /(0x)?[[:xdigit:]]+/
answered Feb 26 '14 at 21:13
smathysmathy
19.8k53964
19.8k53964
add a comment |
add a comment |
This will match with or without 0x
prefix
(?:0[xX])?[0-9a-fA-F]+
add a comment |
This will match with or without 0x
prefix
(?:0[xX])?[0-9a-fA-F]+
add a comment |
This will match with or without 0x
prefix
(?:0[xX])?[0-9a-fA-F]+
This will match with or without 0x
prefix
(?:0[xX])?[0-9a-fA-F]+
answered Jul 1 '13 at 13:35
Pawel FurmaniakPawel Furmaniak
2,70032232
2,70032232
add a comment |
add a comment |
It's worth mentioning that detecting an MD5 (which is one of the examples) can be done with:
[0-9a-fA-F]{32}
add a comment |
It's worth mentioning that detecting an MD5 (which is one of the examples) can be done with:
[0-9a-fA-F]{32}
add a comment |
It's worth mentioning that detecting an MD5 (which is one of the examples) can be done with:
[0-9a-fA-F]{32}
It's worth mentioning that detecting an MD5 (which is one of the examples) can be done with:
[0-9a-fA-F]{32}
answered Sep 8 '14 at 13:00
AdaddinsaneAdaddinsane
33349
33349
add a comment |
add a comment |
If you're using Perl or PHP, you can replace
[0-9a-fA-F]
with:
[[:xdigit:]]
This ought to be a self-contained answer.
– Peter Mortensen
Aug 15 '16 at 14:10
add a comment |
If you're using Perl or PHP, you can replace
[0-9a-fA-F]
with:
[[:xdigit:]]
This ought to be a self-contained answer.
– Peter Mortensen
Aug 15 '16 at 14:10
add a comment |
If you're using Perl or PHP, you can replace
[0-9a-fA-F]
with:
[[:xdigit:]]
If you're using Perl or PHP, you can replace
[0-9a-fA-F]
with:
[[:xdigit:]]
answered Aug 12 '15 at 14:41
joachimjoachim
8,29592934
8,29592934
This ought to be a self-contained answer.
– Peter Mortensen
Aug 15 '16 at 14:10
add a comment |
This ought to be a self-contained answer.
– Peter Mortensen
Aug 15 '16 at 14:10
This ought to be a self-contained answer.
– Peter Mortensen
Aug 15 '16 at 14:10
This ought to be a self-contained answer.
– Peter Mortensen
Aug 15 '16 at 14:10
add a comment |
Just for the record I would specify the following:
/^[xX]?[0-9a-fA-F]{6}$/
Which differs in that it checks that it has to contain the six valid characters and on lowercase or uppercase x in case we have one.
add a comment |
Just for the record I would specify the following:
/^[xX]?[0-9a-fA-F]{6}$/
Which differs in that it checks that it has to contain the six valid characters and on lowercase or uppercase x in case we have one.
add a comment |
Just for the record I would specify the following:
/^[xX]?[0-9a-fA-F]{6}$/
Which differs in that it checks that it has to contain the six valid characters and on lowercase or uppercase x in case we have one.
Just for the record I would specify the following:
/^[xX]?[0-9a-fA-F]{6}$/
Which differs in that it checks that it has to contain the six valid characters and on lowercase or uppercase x in case we have one.
edited Sep 15 '17 at 11:19
Rimian
20.1k99199
20.1k99199
answered Jul 6 '16 at 21:16
batspybatspy
30536
30536
add a comment |
add a comment |
This one makes sure you have no more than three valid pairs:
(([a-fA-F]|[0-9]){2}){3}
Any more or less than three pairs of valid characters fail to match.
add a comment |
This one makes sure you have no more than three valid pairs:
(([a-fA-F]|[0-9]){2}){3}
Any more or less than three pairs of valid characters fail to match.
add a comment |
This one makes sure you have no more than three valid pairs:
(([a-fA-F]|[0-9]){2}){3}
Any more or less than three pairs of valid characters fail to match.
This one makes sure you have no more than three valid pairs:
(([a-fA-F]|[0-9]){2}){3}
Any more or less than three pairs of valid characters fail to match.
answered Sep 18 '14 at 17:53
Local NeedsLocal Needs
1912317
1912317
add a comment |
add a comment |
If you are looking for an specific hex character in the middle of the string, you can use "xhh" where hh is the character in hexadecimal. I've tried and it works. I use framework for C++ Qt but it can solve problems in other cases, depends on the flavor you need to use (php, javascript, python , golang, etc.).
This answer was taken from:http://ult-tex.net/info/perl/
Hey! While this might be true for perl, it doesn't seem to be the case for Regular Expressions in all programming languages. According to thisx
is the equivalent tou
in other languages.
– Maurice
Jan 2 '17 at 16:07
What is "especific anda"?
– Peter Mortensen
Sep 25 '17 at 12:19
add a comment |
If you are looking for an specific hex character in the middle of the string, you can use "xhh" where hh is the character in hexadecimal. I've tried and it works. I use framework for C++ Qt but it can solve problems in other cases, depends on the flavor you need to use (php, javascript, python , golang, etc.).
This answer was taken from:http://ult-tex.net/info/perl/
Hey! While this might be true for perl, it doesn't seem to be the case for Regular Expressions in all programming languages. According to thisx
is the equivalent tou
in other languages.
– Maurice
Jan 2 '17 at 16:07
What is "especific anda"?
– Peter Mortensen
Sep 25 '17 at 12:19
add a comment |
If you are looking for an specific hex character in the middle of the string, you can use "xhh" where hh is the character in hexadecimal. I've tried and it works. I use framework for C++ Qt but it can solve problems in other cases, depends on the flavor you need to use (php, javascript, python , golang, etc.).
This answer was taken from:http://ult-tex.net/info/perl/
If you are looking for an specific hex character in the middle of the string, you can use "xhh" where hh is the character in hexadecimal. I've tried and it works. I use framework for C++ Qt but it can solve problems in other cases, depends on the flavor you need to use (php, javascript, python , golang, etc.).
This answer was taken from:http://ult-tex.net/info/perl/
edited Dec 7 '17 at 0:24
answered Jan 2 '17 at 15:29
Fábio BorgesFábio Borges
12
12
Hey! While this might be true for perl, it doesn't seem to be the case for Regular Expressions in all programming languages. According to thisx
is the equivalent tou
in other languages.
– Maurice
Jan 2 '17 at 16:07
What is "especific anda"?
– Peter Mortensen
Sep 25 '17 at 12:19
add a comment |
Hey! While this might be true for perl, it doesn't seem to be the case for Regular Expressions in all programming languages. According to thisx
is the equivalent tou
in other languages.
– Maurice
Jan 2 '17 at 16:07
What is "especific anda"?
– Peter Mortensen
Sep 25 '17 at 12:19
Hey! While this might be true for perl, it doesn't seem to be the case for Regular Expressions in all programming languages. According to this
x
is the equivalent to u
in other languages.– Maurice
Jan 2 '17 at 16:07
Hey! While this might be true for perl, it doesn't seem to be the case for Regular Expressions in all programming languages. According to this
x
is the equivalent to u
in other languages.– Maurice
Jan 2 '17 at 16:07
What is "especific anda"?
– Peter Mortensen
Sep 25 '17 at 12:19
What is "especific anda"?
– Peter Mortensen
Sep 25 '17 at 12:19
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f9221362%2fregular-expression-for-a-hexadecimal-number%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
1
Regex doesn't really parse. Try extracting all number-like things and sift out the ones that aren't hexadecimals.
– Blender
Feb 10 '12 at 1:10