0

String url = "mysite.com/index.php?id=12&id=432&id=145...".

i have an url with multiple parameters that have the same name "id".i want to know how to match it with java regex?

0

2 Answers 2

1

Here's a regex that will match the parameter scheme you described:

((id=\d+&?)+id=\d+[^&])

Regular expression visualization

Debuggex Demo

Sign up to request clarification or add additional context in comments.

1 Comment

please how can i force it to not end with the & character?
1

This regex should catch the ids

(id=\d+&?)*

Considering that, for some URLs you may not have ids appended.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.