A
A
andrey_levushkin2020-04-29 14:16:45
C++ / C#
andrey_levushkin, 2020-04-29 14:16:45

How to find hexadecimal numbers in a string?

A string is given that contains various text, including its hexadecimal numbers. How to find all these numbers in a string?
Any language is welcome. Well, or at least the algorithm of actions.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Timur Pokrovsky, 2020-04-29
@andrey_levushkin

The easiest way is with a regular expression0x[\dA-Fa-f]+

M
mayton2019, 2020-04-29
@mayton2019

There may be pitfalls here.
In arbitrary English text, there are some independent words that cover
the range 0x0..0xF and there will be false positives on articles: "a" and generally short
words like "cafe" which are technically perceived as a hex number.
Look up all the words that cover abcdef.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question