LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-24-2007, 07:21 AM   #1
iceman_san
LQ Newbie
 
Registered: Aug 2007
Posts: 21

Rep: Reputation: 15
printing the numbers between 20 to 80 in perl using a regular expression


hi,

can any one tell me , how to write a regular expression in perl, which matches all the hexa decimal numbers between 20 to 7f and print them ,


thanks in advance


---------------------------------------------

FREE as in FREEDOM thats LIFE
 
Old 08-24-2007, 09:41 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Sounds a bit odd, written like that.
Can you give us a bit more context?
Regexes aren't always the best way to go...
 
Old 08-24-2007, 08:21 PM   #3
Poetics
Senior Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181

Rep: Reputation: 49
I have no idea why you would want to (or how) write a RegExp to count numbers for you ...

A simple while or foreach loop should be able to handle this for you, provided you use the \x escape for making the numbers hex.
 
Old 08-27-2007, 02:35 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
You might find this page handy: http://perldoc.perl.org/functions/hex.html
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
perl regular expression problem true_atlantis Programming 4 05-27-2009 07:35 AM
Perl Regular Expression abdul_zu Linux - Software 2 08-20-2007 04:57 AM
Having trouble with a perl regular expression... jayemef Programming 3 08-26-2005 12:00 AM
Perl Regular Expression rch Programming 14 07-12-2003 12:00 AM
using a perl regular expression in php markus1982 Programming 5 11-18-2002 03:31 PM


All times are GMT -5. The time now is 09:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration