Forum Discussion
Regexp for complex password
Hi Guys,
Need help for below regexp,
when HTTP_REQUEST_DATA {
set payload [URI::decode [HTTP::payload]]
regexp {^.*txtURL=([^&]+).*$} $payload -> gotURL
regexp {^.*username=([^&]+).*$} $payload -> username
regexp {^.*password=([^&]+).*$} $payload -> password
HTTP::release
}
works for simpel password, but facing issue with password having following characters
$,&, % etc.
sample string
--- <HTTP_REQUEST_DATA>: Payload is = username=apptest&password=1234&1abc&txtURL=https://trng.example.com:443/ssoman/c/SSA
Regards,
Sajid
2 Replies
- corrado
Altostratus
This might work if there is always a field starting with &, like &txtURL, after the "password=" filed.
I asslumed that since you use a regex that excludes character & , but as you said passwords containing character '&' will not be matched while using this regex you will always have "&" as a character after the password so everything but last & will match.
^.*password=(\K.*)&
- Sajid
Cirrostratus
Hi Corrado,
Thanks for your response.
Got this error,
warning: ["\K" has no meaning. Did you mean "\\K" or "K"?][{^.*password=(\K.*)&}]
Regards,
Sajid
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com