I have two different versions of a string that look like this:
The Student's Companion *Author: Alcock, Pete;May, Margaret;Wright, Sharon*MIL EAN/ISBN: 9781283333115
Java Programming: Java Expert*Author:Sarang, Poornachandra*MIL EAN/ISBN: 9781280117268
Now, I am trying to extract the first authors, which are Alcock, Pete and Saran, Poornachandra.
Currently, in Javascript, I am attempting the following:
var regex = new RegExp("(Author:)\\s(.+)(?=;|MIL)");
var regexVal = value.match(regex);
console.log(regexVal);
OR
var regex = new RegExp("(Author:)\\s(.+)(?=MIL)");
var regexVal = value.match(regex);
console.log(regexVal);
The second Regex functions well when there is only one author, however, if there are multiple authors, I need it to capture the value until the first ; not MIL
| should match either part, so shouldn't it stop at the first ;?
Best regards, Ravish