5
votes

I have this response in HTTP request as below

href="index.php?module=Meetings&action=DetailView&record=ed51c2d9-1958-bd61-cce1-509d30ccd4ac">

I want to get the value of "record", but when I set

Regular Expression : record=(.+?)

only "e" is returned. What do I need to do instead?

2

2 Answers

6
votes

Well the regular expression consumes as little as possible (due to the ?). Hence, it is satisfied after taking in the first character. You should probably rather make it greedy and restrict the possible characters (so that it cannot go past the end of the parameter):

record=([a-f0-9-]+)

If you do not know which characters are allowed as the parameter's value, you could also say, consume everything but ampersands and quotes:

record=([^"'&]+)

Depending on where you use it, you might need to escape one of the quotes with a backslash.

0
votes

The given text

href="index.php?module=Meetings&action=DetailView&record=ed51c2d9-1958-bd61-cce1-509d30ccd4ac">

Regular Expression to get the record values from the given text values

record=(.+)"

Regular Expression gets the following record values

record=ed51c2d9-1958-bd61-cce1-509d30ccd4ac"