0

I have this string ?foo=bar&language=fr&bar=foo or this string ?language=fr

I want to capture (fr) so i did the below:

/language=(.*)(?:\&)?/

A link for the regex, https://regexr.com/440ga

3
  • 2
    E.g. /language=([^&]*)/ Commented Nov 29, 2018 at 10:20
  • Thanks @WiktorStribiżew :) I surely didn't know about that trick :) Commented Nov 29, 2018 at 10:22
  • @DjoryKrache you better test your comment/answer before Commented Nov 29, 2018 at 10:25

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.