Reputation: 57
I have a code snippet like below:
import VLink from '../../components/vlink/vlink'
export default {
template: "<div class=\"about\">\n <VLink></VLink>\n <p>This is an about page.</p>\n</div>",
components: {
VLink
},
data () {
return {
};
}
}
// import Vue from 'vue'
// import VLink from '../../components/vlink/vlink'
// export default {
// template: __inline('home.html'),
// components: {
// VLink
// }
// }
And I want to isolate the template value from the code which is not commented.It means that I just want to get the code of <div class="about">...</div>
not the code of __inline('home.html')
in comment. How can I achieve the goal by regex?
Thanks.
Upvotes: 0
Views: 48
Reputation: 17064
Try this:
^[^\/]{2}\s*template:\s*(.*),
You will get the desired code captured in the group1.
Demo: https://regex101.com/r/oZkfXF/2
Upvotes: 1