Hi,
I'm trying to replace different parts of a html code using a single regexp.
For exemple i have this text :
option_!!NID!! [somme_text][5] some_text_option 5_option_some_text
using this regexp:
content.replace(/(!!NID!!)|\[(\d)\]|(\d)_option/g, 1))
I expect to get :
option_1 [somme_text][1] some_text_option 1_option_some_text
but I have :
option_1 [somme_text]1 some_text_option 1_some_text
Can some one tell me how to do what i want, using a single regexp ?? Because i don't understand why the replace doesn't only replace the target between the parenthesis.
Thanks :)
PS : I'm using Ror so a ruby and JS solution is also possible.