dimanche 28 juin 2015

regex encapsulation

I've got a question concerning regex.

I was wondering how one could replace an encapsulated text, something like {key:23} to something like <span class="highlightable">23</span, so that the entity will still remain encapsulated, but with something else.

I will do this in JS, but the regex is what is important, I have been searching for a while, probably searching for the wrong terms, I should probably learn more about regex, generally.

In any case, is there someone who knows how to perform this operation with simplicity?

Thanks!

Aucun commentaire:

Enregistrer un commentaire