0

I'm pretty bad in regexp and I would really appreciate your advice. I have string in JavaScript containing two links with the white space in between. So basically every time this occurs </a> <a to change it into </a><a.

Thank you!

mrkva
  • 336
  • 2
  • 13

4 Answers4

2

Use:

var newstring = mystring.replace(/<\/a>\s+<a/g, "</a><a");
0
var output = input.replace(/<\/a>\s+<a/g,"</a><a")
Billy Moon
  • 57,113
  • 24
  • 136
  • 237
0

Could be something like this:
find /<\/a>[\s\r\n]+<a/g
replace "</a><a"

-1

Try

string = string.replace("</a> <a","</a><a")

or

string = string.replace(/<\/a>\s+<a/g,"</a><a")

to replace also multiple spaces, tabs etc.

morja
  • 8,297
  • 2
  • 39
  • 59