[UPHPU] regex help for a rewrite

justin justin at justinhileman.info
Fri Aug 22 14:50:50 MDT 2008


On Fri, Aug 22, 2008 at 3:51 PM, Wade Preston Shearer
<lists at wadeshearer.com> wrote:
> This is what I have so far:
>
> ^(([^/][^-][^/])+)((/-/)(([^/][^-][^/])*))?$
>
>
> Here is what I am trying to match in English:
>
> (anything except the string "/-/")(optional: the string "/-/" followed by
> anything except the string "/-/")
>

replying to all this time :)

try this:

^(?!.*/-/.*/-/)((.+?)/-/(.*)|(.*))$

matches:

0 - the full line (if it meets the requirements)
1 - everything before the /-/, if /-/ exists.
2 - everything after the /-/, if /-/ exists and if there is anything after it.

justin
-- 
http://justinhileman.com


More information about the UPHPU mailing list