const regex = /\.(?>post|put|get|patch|delete|head|options)\((?>[\"\']?)(\/?api(?>\/\w+){0,}\/?)\w+/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('\\.(?>post|put|get|patch|delete|head|options)\\((?>[\\"\\\']?)(\\\/?api(?>\\\/\\w+){0,}\\\/?)\\w+', 'gm')
const str = `", "/api/bike/portal/available/hours", "/api/bike/portal/business/status", "/api/bike/portal/earnings/aggregate", "/api/bike/portal/roles/profile"],
.//2022101152_16.b89695434a4e47b29104.js:4402: return this.httpClient.get("/api/bike/portal/lastseens/bikecompany/" + l)
.//2022101152_16.b89695434a4e47b29104.js:4407: }).join(","))), e.length && (t = t.set("businessStatus", e.join(","))), this.httpClient.get("/api/bike/portal/bikeCompany/" + l + "/businesss/lastseens", {
.//2022101152_16.b89695434a4e47b29104.js:4411: return this.httpClient.get("/api/bike/portal/" + l + "/metadata/dcts")
.//2022101152_16.b89695434a4e47b29104.js:6299: return this.httpClient.post("/api/bike/portal/switching/business/noc/accept", {
this.httpClient.get("/api/bike/portal/" + l + "/" + n + "/profile")
post("/api/bike/portal/" + l + "/email/verification/response", {
.get("/api/bike/portal/" + l + "/invoices")
.//2022101152_16.b89695434a4e47b29104.js:6709: return this.httpClient.delete("/api/bike/portal/" + l + "/invoices/" + n + "/download-link", {
.//2022101152_16.b89695434a4e47b29104.js:7357: return this.httpClient.put("/api/bike/portal/earnings/cycles/" + l + "/partial", {
.//2022101152_16.b89695434a4e47b29104.js:7362: return this.httpClient.head("/api/bike/portal/business/acceptance/" + l, {
.//2022101152_16.b89695434a4e47b29104.js:7367: return this.httpClient.options("/api/bike/portal/available/hours/" + l, {`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions