[Tutor] problem in replacing regex
hihiren1 at gmail.com
Mon Apr 6 16:23:25 CEST 2009
I have one account number. I want to replace all this account numbers and
convert them as URLS.
but I don't want to convert existing urls which has account numbers.
first i convert any existing url into <a> and then I check that if any above
number exist then I convert them to my site's url .
i am already having regex to check and replace this number. And I can
replace all occurrences of this number and convert them into url using
but problem is that if the value is http://sadfsdf.com/1234-4578 then it
first converts http://sadfsdf.com/1234-4578 into <a href="
http://sadfsdf.com/1234-4578">http://sadfsdf.com/1234-4578</a> and then
again it converts last number into url so the complete url gets broken.
can anybody help me how can I omit the searching existing urls with above
I have already tried many examples but none of them seems working. Although
I can use re.sub('[^/](myregex)','<desirect replacement>',value) but it
won't be a permenant solution as if somebody enters /1234-4578 then also it
won't convert it.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor