F
fritz-bayer
Hi,
I 'm looking for a regular expression, which will find a certain word
in a text and replace it, if and only if it does not appear inside an
a html link or inside a tag, for example as an attribute or tag name.
So, for example the following text should not match and be replaced:
<a href='/index.html'>WORD TO MATCH</a> ....
<image alt='WORD TO MATCH' src='../image.gif'> ..
but the following should be replaced
<body><h1>WORD TO MATCH</h1>...
I guess I would have to use a positive lookahead or lookaround
construct to achieve this. I have tried, but could not come up with
anything that will do the job.
Can some pro help me out?
Fritz
I 'm looking for a regular expression, which will find a certain word
in a text and replace it, if and only if it does not appear inside an
a html link or inside a tag, for example as an attribute or tag name.
So, for example the following text should not match and be replaced:
<a href='/index.html'>WORD TO MATCH</a> ....
<image alt='WORD TO MATCH' src='../image.gif'> ..
but the following should be replaced
<body><h1>WORD TO MATCH</h1>...
I guess I would have to use a positive lookahead or lookaround
construct to achieve this. I have tried, but could not come up with
anything that will do the job.
Can some pro help me out?
Fritz