diff --git a/src/utils.ts b/src/utils.ts index 26a91cd77..9390aa606 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -7,8 +7,8 @@ import { NameValuePair } from "./contracts/nameValuePair"; export class Utils { public static getResourceName(resource: string, fullId: string, resultType: string = "name"): string { - const regexp = new RegExp(`\/${resource}\/(?!${resource})(.*)`); // negative lookahead to escape cases when "resource" is in "fullId" multiple times in a row (e.g. ...apis/operations/operations/foo - https://github.com/Azure/api-management-developer-portal/issues/2112 ) - const matches = regexp.exec(fullId); + const regexp = new RegExp(`\/${resource}\/((?!${resource}\/).*)`);// negative lookahead to escape cases when "resource" is in "fullId" multiple times in a row (e.g. ...apis/operations/operations/foo - https://github.com/Azure/api-management-developer-portal/issues/2112 ) + const matches = regexp.exec(fullId); if (matches && matches.length > 1) { switch (resultType) {