John
John

Reputation: 69

Regular expression parameters string

How i can cut in my string this

&ertert&User=3435&5454&Parameters=asasasa

I want to see only 3435 I have this already , but i don't know how to cut only 3435

&User=(\d+)

Upvotes: 1

Views: 62

Answers (1)

Amit Joki
Amit Joki

Reputation: 59232

You could use lookaheads and behinds provided you've got their support as you've not mentioned the language.

/(?<=User=).+?(?=&)/

The above regex will only match 3435

The lookbehind (?<=User=) is to make sure the number what we are trying to match is preceded with the token provided in the look behind. In this case User=

Upvotes: 3

Related Questions