Jump to content

like _WinHttpCrackUrl using regex


Go to solution Solved by jugador,

Recommended Posts

  • Solution
Posted (edited)
https://www.Example.com/api/DataIndex/Box?ETime=1658773607000&interval=1&STime=1658255400000

output Array:
Row0 => https
Row1 => www.Example.com
Row2 => 
Row3 => /api/DataIndex/Box
Row4 => ?ETime=1658773607000&interval=1&STime=1658255400000

 

https://www.example.com:8100/

output Array:
Row0 => https
Row1 => www.example.com
Row2 => 8100
Row3 => /
Row4 =>

 

wss://example.com:8443/

output Array:
Row0 => wss
Row1 => example.com
Row2 => 8443
Row3 => /
Row4 =>

 

Edit: ok done :D

Func __CrackURl($e_Url)
    Local $e_Regex = '^(http[s]?|ftp|wss):\/\/([^:\/\s]+):?([^\/]*)?([^#?\s]+)(.*)$'
    Return StringRegExp($e_Url, $e_Regex , 3)
EndFunc

 

Edited by jugador

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...