Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
reading a hex number and freq

Posted by miguelrab (miguelrab), 28 November 2006
  I need little help. can u please tel me how can I read  hex numbers between a range of number of digits e.g how can i read four to 30 digit hex numbers from large amount of given data by using tcl.

Posted by admin (Graham Ellis), 28 November 2006
I'm not clear that I understand your specification exactly. Can you post up a sample of the data and desired result, and also the code you've tried so far?  Thanks

Posted by miguelrab (miguelrab), 28 November 2006
For Example if I have data
bjhkhihhhmnnoj kpi boot:0x08Ahiyiyin boot:0x897Abjjhjbjboot:0x124456A

Posted by miguelrab (miguelrab), 28 November 2006
for example if i have data
hgfsdhfghdgfrboot:0x122hjhkhknkboot:0x122Agugugu boot:0x89A676Biiu9iuou

output should be:

boot: 0x122A

so it looks at whole data which is string and takes out hex numbers from it which should are of minimum 4 digits and maximum 30 digits. It ignores all the other numbers.

Posted by admin (Graham Ellis), 28 November 2006
Ah .... with you now.   Have a look at the regexp command and that should do the trick for you.    Capture all matches to 0x followed by hex digits ...

Posted by miguelrab (miguelrab), 29 November 2006
Hi graham
But how can I define the range of digits using regexp it only handles fixed number of digits that i define.

Posted by admin (Graham Ellis), 29 November 2006
Use a count such as {4,30} if you want to match between 4 and 30 of the preceeding element.

Use [0-9a-fA-F] to specify "any hex digit".

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2022: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho