Request to all PureBasic aficionados on the forum: Recently stumbled across the following PB code which uses Regex to identify whether or not a string constitutes a valid URL:
Would any of you PB-literate intelligensia be prepared to make this into a DLL which can return a list of all valid URLs from within a given string/table? Seems like a good regex which I'd hate to otherwise see go to waste.
Or perhaps at least, give me some instruction on how to do it, myself? I do know how to make a very basic 'Hello World' DLL with Pure Basic, but don't yet understand how to translate the above code into something that would return a list of URLs from any given string/table.
Have been blundering around in the PB Help file for hours but my grasp of PB is still so completely retarded at the moment, that it's just turning into an exercise in frustration.

Code:
; Source: [URL]https://www.purebasic.fr/english/viewtopic.php?f=12&t=44359[/URL] ; Validates URLS ; -------------- ; Must include a scheme such as http:// or ftp:// ; Support for port numbers and numeric IPs ; ; Returns bool (#True or #False) ; ----------------------------------------------- Procedure.b ValidURL(url.s) regex.i pattern.s = "^([a-z0-9]+://)(([0-9a-z_!~*'().&=+$%-]+:)?[0-9a-z_!~*'().&=+$%-][email protected])?(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-z_!~*'()-]+\.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\.[a-z]{2,6})(:[0-9]{1,4})?((/?)|(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$" If CreateRegularExpression(regex, pattern) If MatchRegularExpression(regex, url) FreeRegularExpression(regex) ProcedureReturn #True EndIf EndIf FreeRegularExpression(regex) ProcedureReturn #False EndProcedure
Or perhaps at least, give me some instruction on how to do it, myself? I do know how to make a very basic 'Hello World' DLL with Pure Basic, but don't yet understand how to translate the above code into something that would return a list of URLs from any given string/table.
Have been blundering around in the PB Help file for hours but my grasp of PB is still so completely retarded at the moment, that it's just turning into an exercise in frustration.

Comment