regex - Regular Expression for retrieving File Extension in http url -


i working on elk stack , part of logstash data transformation transforming data in apache access logs.

one of metric needed stat on different content types (aspx, php, gif, etc.).

from log file trying retrieve request url , deduce file type, ex /c/dataservices/online.jsp?callback request , .aspx using regular expression \.\w{3,4}.

my regular expression wont work request /etc/designs/design/libs.min.1253.css returning me .min extension.

i trying last extension not working. please suggest other approaches.

you need anchor match end of string or beginning of query param ?. try:

\.\w{3,4}($|\?) 

play here: https://regex101.com/r/iv3im1/1


Comments