{"ScriptPreparationCode":"const testPath = \u0022http://foo.org/smth/teachers/ad0bfc84-3d16-46c3-948c-2f8d08976fcc/bar\u0022;\r\nconst userIdPathSegments = [\u0027students\u0027, \u0027teachers\u0027];\r\nconst userIdPathSegmentRegexps = [new RegExp(/students\\/(?\u003CuserId\u003E\\w\u002B)/), new RegExp(/teachers\\/(?\u003CuserId\u003E\\w\u002B)/)];","TestCases":[{"Name":"Split","Code":"const pathParts = testPath.split(\u0027/\u0027).filter(p =\u003E p);\r\nconst userIdIndex = pathParts.findIndex(p =\u003E userIdPathSegments.some(aPN =\u003E p === aPN));\r\nif (userIdIndex \u003E= 0 \u0026\u0026 pathParts.length \u003E userIdIndex \u002B 1) {\r\n\tpathParts[userIdIndex \u002B 1];\r\n}","IsDeferred":false},{"Name":"regex","Code":"for (let i = 0; i \u003C userIdPathSegmentRegexps.length; i\u002B\u002B) {\r\n const match = testPath.match(userIdPathSegmentRegexps[i]);\r\n if (Array.isArray(match) \u0026\u0026 match.length == 2 \u0026\u0026 match[1].length \u003E 0) {\r\n return match[1];\r\n }\r\n}","IsDeferred":false}]}