Reputation: 4421
How can I turn this "- | " into "-" with jQuery?
.replace(/__-__ | /g, '__-__'
This also replaces the empty spaces
.replace('__-__ | ', '__-__'
This only replaces the first time it occurs
Upvotes: 1
Views: 609
Reputation: 4421
You answer helpt me out! :)
.replace(/__-__ \|/g, '__-__')
This worked just great! Thanx!
Upvotes: 0
Reputation: 5782
Not sure why you're attempting this in jQuery. String replace is a javascript string method unless you're talking about replacing DOM elements.
input.replace(/- \|/g, '-_-');
Upvotes: 2