Forum Discussion
stream find/replace expression with an exclude - take 2
--
the problem is i'm breaking internet explorer compatibility with a find/replace that i'm doing. here's a more specific example. again, three different strings:
[base href="http://www.domain.com/" /]
[a href="http://www.domain.com/path/to/file.jpg width="123" height="456" /]
[a href=http://www.domain.com/file/without/quotes.html /]
now, if i do something like this, it replaces all three domain names with "/" however i only want to replace the second two, not the first since it breaks compatibility with internet explorer:
STREAM::expression {@http://forexforums.dailyfx.com/@/@}
using stream_matched might do the job, i was hoping there'd be something a little simpler though.
thanks.
3 Replies
- hoolio
Cirrostratus
I think this might work, if you only want to rewrite a href's:when HTTP_REQUEST { Disable the stream filter for all requests STREAM::disable } when HTTP_RESPONSE { Check if response type is text if {[HTTP::header value Content-Type] contains "text"}{ Match a tags for http://www.domain.com/ STREAM::expression {@
- Nik
Cirrus
it would be things like img and embed also, i just want to exclude base href. - hoolio
Cirrostratus
You could make the regex more general and then check that STREAM::match in STREAM_MATCHED doesn't contain "< base href" before doing the replacement. This would match < followed by any number of chars that aren't a > followed by http://www.domain.com/:STREAM::expression {@<[^>]*?http://www.domain.com/@@}
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com