| Author |
Simple (I hope) regex question
|
Phil Chuang
Ranch Hand
Joined: Feb 15, 2003
Posts: 251
|
|
I'm working on writing an http tunnel kind of servlet, and I need some help with url replacement. I'm using a Map to translate from an alias to an address. So, for the alias "blah" and the address "blah.com" I want to replace all href links such that <a href="http://blah.com/hello.html"> --> <a href="http://localhost/blah/hello.html"> OR <a href="hello.html"> --> <a href="http://localhost/blah/hello.html"> Can someone help me out with a regex pattern or patterns that will match <a href=" + http:// + aliasAddress OR <a href=" + not http:// I've got the pattern for the first one, the problem is the 2nd one. [ September 23, 2003: Message edited by: Phil Chuang ]
|
 |
Phil Chuang
Ranch Hand
Joined: Feb 15, 2003
Posts: 251
|
|
Just to clarify: If the full URI is http://localhost/tunnel/blah/ and the alias is http://www.blah.com:8080 then I want to replace all links like this: <a href="http://www.blah.com:8080/hello.html"> --> <a href="http://localhost/tunnel/blah/hello.html"> <a href="hello.html"> --> <a href="http://localhost/tunnel/blah/hello.html"> but not like this: <a href="http://www.blah2.com/"> [ September 23, 2003: Message edited by: Phil Chuang ] [ September 23, 2003: Message edited by: Phil Chuang ]
|
 |
 |
|
|
subject: Simple (I hope) regex question
|
|
|