Mr J
12-21-2003, 08:03 PM
Hi everybody
I am wanting to replace the Break tags "<br>" in a string.
All is well with a single break tag but if I have two together "<br><br>" then only one is replaced.
I am using the following code
<script>
function mailme(){
txt="This<br>is<br><br>a<br>test"
pattern = /\<br>\b/ig;
newString = txt.replace(pattern,"%0D%0A");
location="mailto:yourname@youraddress.com?Body="+newString
}
</script>
<a href="#null" onclick="mailme()">Mail Me</a>
What I should get is an empty line between "is" and "a"
This
is
a
test
What I actually get when two br tags are together is
This
is<br>
a
test
note the break tag
I am not really up on reg expressions so I need a bit of help here
Thank you
I am wanting to replace the Break tags "<br>" in a string.
All is well with a single break tag but if I have two together "<br><br>" then only one is replaced.
I am using the following code
<script>
function mailme(){
txt="This<br>is<br><br>a<br>test"
pattern = /\<br>\b/ig;
newString = txt.replace(pattern,"%0D%0A");
location="mailto:yourname@youraddress.com?Body="+newString
}
</script>
<a href="#null" onclick="mailme()">Mail Me</a>
What I should get is an empty line between "is" and "a"
This
is
a
test
What I actually get when two br tags are together is
This
is<br>
a
test
note the break tag
I am not really up on reg expressions so I need a bit of help here
Thank you