EDIT: Mea culpa! Committed the cardinal sin of asking for a library recommendation and was swiftly put to rights. Here's the problem: I have two or more pieces of text. For example:
a: Here's some text.
b: Here's some more text.
c: Here's some text with the word blue.
And want to get:
'Here's some <var_1>text<var_2>.'
where
var_1 document a holds ''
var_1 document b holds 'more '
var_1 document c holds ''
var_2 document c holds ''
var_2 document b holds ''
var_2 document c holds ' with the word blue'
This is for a Javascript-based web app heavily reliant on jQuery; however for testing I need solution that is compatible with node.js.
A simple regex like
/(.*)text(.*)/
might do it.Then you can use
String.match()
method to get the values of the capturing groups.