zer has asked for the wisdom of the Perl Monks concerning the following question:
Code
Test Data@list = grep (m/(?($_=~ m;^http;)localhost.net|^\/)/;
/sered/uplink <--test true
/my/projects/ <--test true
heh/reg <--test false
http://www.OtherNetwork.org/network/ <--test false
http://www.localhost.net/hello <--test true
Explained
ok so with this regex i want to test for the same scalar that the grep would currently be testing. Basicly saying, if it starts with an "http" it better be on this server. However if it doesnt start with that it has to start with a "/" for a sub directory.
Problem
I am unable to get this to work properly
Appologies
I am new to this advanced regex format so please be patient with me
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Conditional Regex
by Sidhekin (Priest) on Nov 27, 2006 at 06:41 UTC | |
|
Re: Conditional Regex
by fenLisesi (Priest) on Nov 27, 2006 at 12:09 UTC | |
|
Re: Conditional Regex
by Firefly258 (Beadle) on Nov 27, 2006 at 16:27 UTC |