From: <[EMAIL PROTECTED]>

> Hi all,
>
> I am working on a small php script which should do the
> following. I want all the links in the page to be
> preceded by first character and first two characters
> of the link.Please look into the example below for
> more
> clarification.
>
> eg.
> <a href="/code.html">link here</a> to be
> replaced as
> <a href="/c/co/code.html">link here</a>
>
> I guess, this is possible by using regular expressions
> but I am not able to crack the right expression.
>

Hi,

This is not very simple.
The URI which in your example is /code.html can be anything, including
something like m.html.
In that case which would be the first 2 letters?
Or, the URI can be something like m-like.html. In this case the first 2
letters will be "m-" or "ml"?

A good regular expression should work in all situations so it is important
to know what is the desired result, and not to asume that there won't be any
links like "/.html" or something worse.

Teddy

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to