Path Parameters are not populated for some cases with wildcard templates
### Description:
Path Parameters are not populated for a template like /pet/{petID/somestring/* when the rawURL is /pet/1/somestring.

In addition, following log is printed.

```
PathTemplate and RawPath is mismatched.
```

### Steps to reproduce:

### Affected Product Version:
choreo-connect-1.0.0-beta

### Environment details (with versions):
- OS:
- Client:
- Env (Docker/K8s):

---
### Optional Fields
#### Related Issues:
<!-- Any related issues from this/other repositories-->

#### Suggested Labels:
<!--Only to be used by non-members-->

#### Suggested Assignees:
<!--Only to be used by non-members-->

diff --git a/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/ParameterResolver.java b/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/ParameterResolver.java
index 1ba41f305..b102c2fad 100644
--- a/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/ParameterResolver.java
+++ b/enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/ParameterResolver.java
@@ -33,9 +33,11 @@ class ParameterResolver {
     private static final Logger logger = LogManager.getLogger(ParameterResolver.class);
     private final List<String> parameterNames = new ArrayList<>();
     private final Pattern pattern;
+    private String pathTemplate;
 
     public ParameterResolver(final String parameterTemplate) {
         // This formatting is required since /foo and /foo/ are considered to be equal
+        this.pathTemplate = parameterTemplate;
         String formattedPathParamTemplate = parameterTemplate.endsWith("/") ?
                 parameterTemplate.substring(0, parameterTemplate.length() - 1) : parameterTemplate;
         final Matcher matcher = PARAMETER_PATTERN.matcher(formattedPathParamTemplate);
@@ -52,7 +54,7 @@ class ParameterResolver {
         }
         String regex = Pattern.quote(matcher.replaceAll("_____PARAM_____"))
                 .replace("_____PARAM_____", "\\\\E([^/]*)\\\\Q");
-        regex = regex.endsWith("*\\\\E") ? regex.substring(0, regex.length() - 3) + "\\\\E(.*)" : regex;
+        regex = regex.endsWith("*\\\\E") ? regex.substring(0, regex.length() - 4) + "\\\\E($|([/]{1}(.*)))" : regex;
         pattern = Pattern.compile(regex);
     }
 
@@ -63,7 +65,7 @@ class ParameterResolver {
         final Matcher matcher = pattern.matcher(formattedURI);
         if (!matcher.matches()) {
             // Unlikely to occur as this pair is already matched within router.
-            logger.error("PathTemplate and RawPath is mismatched.");
+            logger.debug("PathTemplate: {}  and RawPath: {} is mismatched.", pathTemplate, uriString);
             return new HashMap<>();
         }
         final Map<String, String> map = new HashMap<>();
diff --git a/enforcer-parent/commons/src/test/java/org/wso2/choreo/connect/enforcer/commons/model/RequestContextTest.java b/enforcer-parent/commons/src/test/java/org/wso2/choreo/connect/enforcer/commons/model/RequestContextTest.java
index 6c9e4fe31..c338bdecf 100644
--- a/enforcer-parent/commons/src/test/java/org/wso2/choreo/connect/enforcer/commons/model/RequestContextTest.java
+++ b/enforcer-parent/commons/src/test/java/org/wso2/choreo/connect/enforcer/commons/model/RequestContextTest.java
@@ -72,8 +72,15 @@ public class RequestContextTest {
     public void testPathParameterGenerationWithWildcard() {
         testPathParamValues("/v2/pet/12/2/random/random2", "/v2", "/pet/{petId}/{imageId}/*",
                 "petId", "12");
+        testPathParamValues("/v2/pet/12/2/random/random2/random3", "/v2", "/pet/{petId}/{imageId}/*",
+                "petId", "12");
         testPathParamValues("/v2/pet/12/image/2/random/random2", "/v2", "/pet/{petId}/image/{imageId}/*",
                 "imageId", "2");
+        testPathParamValues("/v2/pet/12/2/image", "/v2", "/pet/{petId}/{imageId}/image/*",
+                "petId", "12");
+        testPathParamValues("/v2/pet/pet-1/image/*", "/v2", "/pet/{imageId}/image/*",
+                "imageId", "pet-1");
+        testMismatchedPaths("/v2/pet/12/2/image123", "/v2", "/pet/{petId}/{imageId}/image/*");
     }
 
     @Test
@@ -107,4 +114,13 @@ public class RequestContextTest {
                 requestContext.getPathParameters().get(pathParamName), expectedValue);
     }
 
+    private void testMismatchedPaths(String rawPath, String basePath, String pathTemplate) {
+        RequestContext.Builder builder = new RequestContext.Builder(rawPath);
+        builder.matchedAPI(new APIConfig.Builder("Petstore").basePath(basePath).build());
+        builder.pathTemplate(pathTemplate);
+        RequestContext requestContext = builder.build();
+        Assert.assertNotNull(requestContext.getPathParameters());
+        Assert.assertEquals(0, requestContext.getPathParameters().size());
+    }
+
 }
['enforcer-parent/commons/src/main/java/org/wso2/choreo/connect/enforcer/commons/model/ParameterResolver.java', 'enforcer-parent/commons/src/test/java/org/wso2/choreo/connect/enforcer/commons/model/RequestContextTest.java']