Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regex / .cgi in URL 1

Status
Not open for further replies.

Extension

Programmer
Nov 3, 2004
311
CA
I was looking for a simple regex to determine if a URL contains a cgi extension (.cgi)

Example:

Code:
[URL unfurl="true"]http://www.sitedomain.com/script.cgi?id=2332&y=44[/URL] would be "True"
sitedomain.com/someotherscript.cgi?x=23 would be "True"
[URL unfurl="true"]http://www.sitedomain.com/somepage.htm[/URL] would be "False"

Thank you
 
or simply:

/\.cgi\??/i

- Kevin, perl coder unexceptional!
 
Hi

You know, I am abit paranoid, so I thought to stupid situations, like :
- dir/dir.cgi/file.htm
- dir/file.htm?ext=.cgi
- dir/file.cgiqwert

Of course, for normal people your solution is also good, Kevin.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top