JavaScript regex refactoring

Posted by JamesBrownIsDead on Stack Overflow See other posts from Stack Overflow or by JamesBrownIsDead
Published on 2010-02-17T02:18:09Z Indexed on 2010/05/04 2:08 UTC
Read the original article Hit count: 301

Filed under:
|

I'm performing this on a string:

var poo = poo
.replace(/[%][<]/g, "'<")
.replace(/[>][%]/g, ">'")
.replace(/[%]\s*[+]/g, "'+")
.replace(/[+]\s*[%]/g, "+'");

Given the similar if these statements, can these regexs be comebined somehow?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about regex