LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   regexp help (https://www.linuxquestions.org/questions/linux-newbie-8/regexp-help-290586/)

cliff76 02-15-2005 01:24 PM

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!

sigsegv 02-15-2005 01:49 PM

Untested: -\d+-?

surya_b4u 03-07-2008 08:10 AM

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

Tinkster 03-07-2008 02:15 PM

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

Closed.


Cheers,
Tink


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