« Return to Thread: Re: [OT] Jquery Remove Trailing "&" From String

Re: [OT] Jquery Remove Trailing "&" From String

by Israel Thompson :: Rate this Message:

Reply to Author | View in Thread

Thanks, that works!

Israel


Brad Lindsay-2 wrote:

> If the string is a JavaScript variable named str, this code should  
> work:
>
> str.replace(/&$/,"");
>
> -Brad


If you want to replace all trailing "&", for example "test&&&&"  
becomes "test", edit the regular expression so that the code looks  
like this:
        str.replace(/&+$/, "");

-Brad

 « Return to Thread: Re: [OT] Jquery Remove Trailing "&" From String