Forum Discussion
gerald_wegener_
Nimbostratus
Jul 11, 2005Regsub always returns a 1 never 0
I've tried running the script that is posted which uses regsub to search for Social Security Numbers in the form xxx-xx-xxxx. I've tried several different permuations of this but can never get anythin...
unRuleY_95363
Jul 11, 2005Historic F5 Account
Yes, that example is wrong. Here is the correct HTTP_RESPONSE_DATA:
when HTTP_RESPONSE_DATA {
set payload [HTTP::payload [HTTP::payload length]]
set ssnx “xxx-xxx-xxxx”
Find the SSN numbers
if { [regsub -all {\d{3}-\d{2}-\d{4}} $payload $ssnx new_response] > 0 } {
Replace the content if there was any matches
HTTP::payload replace 0 [HTTP::payload length] $new_response
}
}
Basically, the variable "new_response" always contains the original payload, except that is has been modified per the regsub. The command returns the count of the number of matching ranges that were found and replaced.
Thanks for catching and pointing this mistake out. I will get the article corrected.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
