
Kanji
User
/ Moderator
May 10, 2002, 10:12 PM
Post #2 of 2
(2129 views)
|
|
Re: [Danni] Spliting a URL with an un-usual query string
[In reply to]
|
Can't Post
|
|
There are a few ways you could do this, the easiest would be to use a regular expression ...
my($cmd,$rest) = $string =~ m/^\W(\w)\W(.*)$/; However, that's very forgiving in what would work (ie, you could use :cmd:var|1/blah|hi+mom or "cmd"var?1:blah and it would still carve the string up appropriately), so you might want something a little more restrictive...
my($cmd,$rest) = $string =~ m<^/([^/?]+)[/?](.*)$>; --k.
|