LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-06-2010, 10:42 AM   #1
ganninu
Member
 
Registered: Jul 2003
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340

Rep: Reputation: 30
Question Regex


Can someone shed some light what these two regex expresssions solve to:

1) ^/(tv\/[^\/]*\/)$
2) ^/tv\/[^\/]\/(.)
 
Old 08-06-2010, 11:00 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by ganninu View Post
Can someone shed some light what these two regex expresssions solve to:

1) ^/(tv\/[^\/]*\/)$
2) ^/tv\/[^\/]\/(.)
How about

man 7 regex

?
 
Old 08-06-2010, 11:02 AM   #3
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,599

Rep: Reputation: 516Reputation: 516Reputation: 516Reputation: 516Reputation: 516Reputation: 516
http://www.regular-expressions.info/
 
Old 08-06-2010, 12:19 PM   #4
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,413

Rep: Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874
As you can see from previous answers, if you don't do any work then no one else is inclined to either.

Maybe tell us either which part you do not understand or what you think it equals or what parts equal?

Then we can assist with either incorrect assumptions or educate on plain wrong solutions.
 
Old 08-06-2010, 12:51 PM   #5
ganninu
Member
 
Registered: Jul 2003
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340

Original Poster
Rep: Reputation: 30
i know i was a bit short and dry in my original post but my apache config is driving me crazy and the regex is the least of my problems atm. anyways, i found the captioned regex expressions and i am trying to make sense out of them to get a complete picture of the infrastructure. These are used within the ProxyPassMatch directive:

1)^/(tv\/[^\/]*\/)$

Match something like this: mydomain.com/tv/anything_but_not_slash/

2) ^/tv\/[^\/]\/(.)

Match something like this: mydomain.com/tv/a

I really hate asking questions i can find answers myself...coming here and being referred to manual pages is really insulting. but anyways, kids.
 
Old 08-06-2010, 01:04 PM   #6
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by ganninu View Post
...coming here and being referred to manual pages is really insulting. ...
Really ? As I have established many times already, people simply do not read. I.e. quite often the needed info is the manpage, sometimes even in the first-second line of description, but people still ask questions instead of reading.

I even sometimes request such askers to parse English sentences from the manpages in question in order to show them that the answer is indeed there, but they didn't read it.

My standard question in such cases is: "What is the very first thing you didn't understand ?".

In fact, when I realize I do not understand something in the text I am reading, I ask myself the same question - giving a concrete answer really helps to move forward.

So, what is the very first thing you didn't understand in the manpage ?

Last edited by Sergei Steshenko; 08-07-2010 at 01:22 AM.
 
Old 08-06-2010, 03:10 PM   #7
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,599

Rep: Reputation: 516Reputation: 516Reputation: 516Reputation: 516Reputation: 516Reputation: 516
http://catb.org/esr/faqs/smart-questions.html#before
http://catb.org/esr/faqs/smart-questions.html#beprecise
http://catb.org/esr/faqs/smart-questions.html#rtfm



Code:
^/(tv\/[^\/]*\/)$
String starts with literal "/tv/". Then has 0 or more characters that are not \ or /*. String ends with a literal /. The substring starting with "tv" and ending with / is captured.
Code:
^/tv\/[^\/]\/(.)
String starts with literal "/tv/". Then has one character that is not \ or /. Then has a literal /. Then, one character is captured. After that one character we don't care what's there and don't even try to match it.

* not sure if [^\/] means "not /" or "not \ or /" since it's in a [] block. I should go back to the manual.

It's odd that you're escaping some /s with \s and some of them you aren't. You don't seem to be using // as regex delimiters (regexes are often delineated by /s, ie "$foo =~ /regexhere/;") so it's not clear whether you need to escape them or not.

Last edited by AlucardZero; 08-06-2010 at 03:12 PM.
 
Old 08-07-2010, 12:41 AM   #8
ganninu
Member
 
Registered: Jul 2003
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340

Original Poster
Rep: Reputation: 30
Yes to me it looks really odd, and since I didn't do the regex, but merely interpreting it in an apache context, I was doubting my regex knowledge and hence came here. In the future I would like to use some tools which help me simulate regex.

Anyways thanks for confirming my thoughts..
 
Old 08-07-2010, 01:14 AM   #9
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,413

Rep: Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874
Quote:
Originally Posted by ganninu
I really hate asking questions i can find answers myself...coming here and being referred to manual pages is really insulting. but anyways, kids.
Is this meant to be a conundrum?

1. You hate asking questions when you can find the answers yourself .... then why ask??

2. You feel insulted because you are directed to a manual page or reference, so your solution is just to tell everyone answers and not educate .... interesting concept

3. Personally I find it insulting to be called a 'kid' when I am 40+ years of age

If you don't want to be educated or don't like the answers, maybe you should learn how to ask a question!!

The link at the bottom of AlucardZero's signature should be your starting point.
 
  


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
I need a vi regex d3funct Linux - General 3 03-16-2009 09:26 AM
Help with regex tbeehler Linux - Software 4 07-11-2008 10:05 AM
regex with sed to process file, need help on regex dwynter Linux - Newbie 5 08-31-2007 05:10 AM
Regex help Penguin of Wonder Programming 4 08-06-2007 07:04 AM
regex help siyisoy Programming 4 04-07-2006 05:32 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration