Forum Discussion
mazek_59373
Nimbostratus
Mar 02, 2009regexp
Hi,
I'm trying to match via a simple regexp an URI. It can be in a form of:
/sth/digits
/sth/digits.digit
/sth/digits_digit
example U...
hoolio
Cirrostratus
Mar 02, 2009Hi Mazek,
Maybe something like this?
% regexp {[/\w]*/(\d+)[._\d]*} /letters/123456_789 unused id
1
% puts $id
123456
% regexp {[/\w]*/(\d+)[._\d]*} /letters/123456.789 unused id
1
% puts $id
123456
% regexp {[/\w]*/(\d+)[._\d]*} /letters/123456 unused id
1
% puts $id
123456
% regexp {[/\w]*/(\d+)[._\d]*} /123456 unused id
In case the regex gets mangled on the forums, try this with the spaces removed:
regexp { [ / \ w ] * / ( \ d + ) [ . _ \ d ] * } $uri unused id
$id will have the value you're looking for.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
