LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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


Closed Thread
  Search this Thread
Old 02-15-2005, 02:24 PM   #1
cliff76
Member
 
Registered: Feb 2005
Location: PA
Distribution: Fedora Core 3
Posts: 48

Rep: Reputation: 15
regexp help


I am no good with regular expressions. Could someone give me a regular expression that grabs (matches) sequences that include a hyphen and a number. I want to match like this:

text-23-more-text-456

hyphen and number and not just hyphens. I got the following:
-[\d]*
but that matches all hyphens and numbers. I just want hyphens followed by any number of numbers. Help!

Last edited by cliff76; 02-15-2005 at 02:34 PM.
 
Old 02-15-2005, 02:49 PM   #2
sigsegv
Senior Member
 
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 46
Untested: -\d+-?
 
Old 03-07-2008, 09:10 AM   #3
surya_b4u
LQ Newbie
 
Registered: Aug 2007
Posts: 6

Rep: Reputation: 0
Wink

Hi Dear

I don't know wat exactly u want.
Try out If u want only " - " before a number :
grep -E '[-]\d*' filename
this may help you.

Suresh
 
Old 03-07-2008, 03:15 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Why on earth did you dig this three year old carcass of a thread up?

Closed.


Cheers,
Tink
 
  


Closed Thread


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
little help for regexp EmOuBi Linux - Newbie 6 08-06-2005 03:19 AM
Regexp problem eremit Programming 6 06-23-2005 07:48 AM
regexp help ... pld Programming 1 03-15-2005 04:45 PM
regexp search for [ wijnands Linux - Newbie 3 06-22-2004 03:15 AM
Regexp stumper lackluster Programming 2 11-02-2002 01:31 AM


All times are GMT -5. The time now is 02:30 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