0

Having a string like:

"*this* not that"

I can select *this*

\*(.*?)\*

but I'm not able to get only this.

what I am trying to achieve is to replace -this- by a new string. What's the easiest way to do that ?

Daniele
  • 799
  • 1
  • 11
  • 23

1 Answers1

1

you can try:

"*this* not that".replace(/\*.*\*/,'*new_string*');
//"*new_string* not that"
Yangguang
  • 1,765
  • 8
  • 10