I am copyig some data from the MS Word. That text may contain or May not contain Bullets in the copied text. But i need a Regular expression in javascript to remove any type of Bullets from the copied text.
for example if i copy the text which is having bullets it is coming like this when i paste it.
Here are some examples
1. Jnflkvkbfjvb
2. Kjnfbhvjbv
3. ;kbvrjvbrjvb
• Jnflkvkbfjvb
• Kjnfbhvjbv
• ;kbvrjvbrjvb
a) Jnflkvkbfjvb
b) Kjnfbhvjbv
c) ;kbvrjvbrjvb
A. Jnflkvkbfjvb
B. Kjnfbhvjbv
C. ;kbvrjvbrjvb
I. Jnflkvkbfjvb
II. Kjnfbhvjbv
III. ;kbvrjvbrjvb
But My requirement is to display without any of these bullets.It has to display
Jnflkvkbfjvb
Kjnfbhvjbv
;kbvrjvbrjvb
My code is
var x=" • Jnflkvkbfjvb• Kjnfbhvjbv• ;kbvrjvbrjvb 1. Jnflkvkbfjvb2. Kjnfbhvjbv3. ;kbvrjvbrjvb ";
x= x.replace(/[•\t.+]/g, '');
x= x.replace(/[[1-9][.]\t.+]/g, '');
alert(x);
Please someone help me.
You can use this to edit the code
http://jsfiddle.net/V2aSg/
Try this
/^\s*(?:[\dA-Z]+\.|[a-z]\)|•)\s+/gm
See it here at Regexr
This checks
^
The start of the row (with the modifier m
)
\s*
any amount of whitespace
[\dA-Z]+\.
At least one (+
) digit or A-Z
followed by a dot
or
[a-z]\)
a-z
followed by a )
or
•
\s+
At least one whitespace at last
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With