views:

59

answers:

2

how to replace multiple occurrences of &nbsp; and <br> at start of the string with javascript regex?

+3  A: 
myString = myString.replace(/^(&nbsp;|<br>)+/, '');

... where /.../ denotes a regular expression, ^ denotes start of string, ($nbsp;|<br>) denotes "&nbsp; or <br>", and + denotes "one or more occurrence of the previous expression". And then simply replace that full match with an empty string.

David Hedlund
thanks..it works great !!!
Rohan
A: 

Hi,

Check this link, this is about string replace in javascript using regular expression and normal method.

Hope helpful.

srinivas