mikehazell / gulp-inject-string

Inject snippets in build
MIT License
40 stars 12 forks source link

Better Replace #5

Open cspeer opened 8 years ago

cspeer commented 8 years ago

Hi there,

how about you modify the replace method a little so it would handle proper regular expressions. Maybe have a look at https://github.com/lazd/gulp-replace/blob/master/index.js#L22

Thanks a lot for this package!

Chris

traktraktrugui commented 8 years ago

I didn't know that I needed escape twice, just a little headache .

Instead this: new RegExp('(\["@Raw\\(Model\.CipherText\)"\])', 'g')

To this: new RegExp('(\\["@Raw\\(Model\\.CipherText\\)"\\])', 'g')

http://stackoverflow.com/a/1162538