Networking Forums

Networking Forums > Computer Networking > Linux Networking > Regular Expression

Reply
Thread Tools Display Modes

Regular Expression

 
 
Dan N
Guest
Posts: n/a

 
      04-08-2008, 04:05 AM
Sorry, this may not be the best newsgroup, but it is the most Linux savvy
of any I know.

I'm trying to figure out a regular expression to match a line with more
than 2 '-' characters in it. Is this possible?

Dan
 
Reply With Quote
 
 
 
 
D. Stussy
Guest
Posts: n/a

 
      04-08-2008, 04:17 AM
"Dan N" <(E-Mail Removed)> wrote in message
news:47faef10$0$13273$(E-Mail Removed)...
> Sorry, this may not be the best newsgroup, but it is the most Linux savvy
> of any I know.
>
> I'm trying to figure out a regular expression to match a line with more
> than 2 '-' characters in it. Is this possible?


(.*)-(.*)-(.*)-(.*)

I don't recall offhand how to collapse that further for the 3 repetitions of
"-(.*)" but the above should work.


 
Reply With Quote
 
Dan N
Guest
Posts: n/a

 
      04-08-2008, 05:36 AM
On Mon, 07 Apr 2008 21:17:09 -0700, D. Stussy wrote:

> (.*)-(.*)-(.*)-(.*)
>
> I don't recall offhand how to collapse that further for the 3 repetitions of
> "-(.*)" but the above should work.


Thanks

Dan
 
Reply With Quote
 
Dan N
Guest
Posts: n/a

 
      04-08-2008, 05:36 AM
On Mon, 07 Apr 2008 21:17:09 -0700, D. Stussy wrote:

> (.*)-(.*)-(.*)-(.*)
>
> I don't recall offhand how to collapse that further for the 3 repetitions of
> "-(.*)" but the above should work.


Thanks

Dan
 
Reply With Quote
 
Unruh
Guest
Posts: n/a

 
      04-08-2008, 06:21 AM
Dan N <(E-Mail Removed)> writes:

>Sorry, this may not be the best newsgroup, but it is the most Linux savvy
>of any I know.


>I'm trying to figure out a regular expression to match a line with more
>than 2 '-' characters in it. Is this possible?


/.*-.*-.*-/

This is hardly a networking question.



>Dan

 
Reply With Quote
 
LEE Sau Dan
Guest
Posts: n/a

 
      04-14-2008, 12:01 AM
>>>>> "Unruh" == Unruh <unruh-(E-Mail Removed)> writes:

>> I'm trying to figure out a regular expression to match a line
>> with more than 2 '-' characters in it. Is this possible?


Unruh> /.*-.*-.*-/

Unruh> This is hardly a networking question.

It looks like a homework question.



--
Lee Sau Dan §õ¦u´° ~{@nJX6X~}

E-mail: (E-Mail Removed)
Home page: http://www.informatik.uni-freiburg.de/~danlee
 
Reply With Quote
 
Jurgen Haan
Guest
Posts: n/a

 
      04-14-2008, 07:46 AM
Dan N wrote:
> Sorry, this may not be the best newsgroup, but it is the most Linux savvy
> of any I know.
>
> I'm trying to figure out a regular expression to match a line with more
> than 2 '-' characters in it. Is this possible?
>
> Dan


Instead of using constructions to match for multiple occurrences of a
character, you should try matching for that character in a line and use
the designated regexp function to return a result count.

But since this is very very basic regexp material, I suggest you read up
on regular expressions (google) before asking stuff on (the wrong)
newsgroups.

-R-
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
wireless regular loses connectivity Chris F Clark Wireless Internet 20 04-03-2007 07:10 PM
DI704 - Can I Use It as A Regular Router? keithatqes Network Routers 0 04-27-2006 11:28 PM
Regular ADSL crashes (through Plus.net) N Orr Broadband 5 10-08-2004 03:09 PM
SpeedTouch Pro as a regular modem Crypto Broadband 1 01-22-2004 10:25 AM
VPN as well as regular connection Superlifer Wireless Internet 2 11-12-2003 03:35 PM



1 2 3 4 5 6 7 8 9 10 11