programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Liutauras Vilda
• Tim Cooke
• Jeanne Boyarsky
• Paul Clapham
Sheriffs:
• Devaka Cooray
• Ron McLeod
• paul wheaton
Saloon Keepers:
• Tim Moores
• Piet Souris
• Tim Holloway
• Stephan van Hulst
• Carey Brown
Bartenders:
• Al Hobbs
• Frits Walraven
• Scott Selikoff

# regex pattern to seaech for hexadecimal

Ranch Hand
Posts: 383
• Number of slices to send:
Optional 'thank-you' note:
This example is for one -digit hexadecimal numbers.

Expression:0[xX][0-9a-fA-F]
Source:"12 ox ox12 oXf oxg"
index: 012345678901234567

And answer is 6 & 11.

I am not getting why the answer is 6 & 11.

This example is from K & B book, chapter: 6 & page no:476.

can anyone help me?

Ranch Hand
Posts: 377
• Number of slices to send:
Optional 'thank-you' note:
Hi dolly,

please be careful to not introduce typos.

The correct sample:

The expression looks first for a zero digit, followed by an x or an X, followed by an hexadecimal digit. The places 6 and 11 are the only ones where these conditions are fulfilled.

dolly shah
Ranch Hand
Posts: 383
• Number of slices to send:
Optional 'thank-you' note:
Thanks I got it.
One more question, Why in book they have said that "\d" doesn't work. You have to type "\\d". But I am able to do "\d".
Page no:481, K & B,
Can you help me?

Manfred Klug
Ranch Hand
Posts: 377
• Number of slices to send:
Optional 'thank-you' note:

Originally posted by dolly shah:
Why in book they have said that "\d" doesn't work. You have to type "\\d". But I am able to do "\d".

Then you have a special compiler. For me it fails with 'illegal escape character'.