regex url validator?
J. Landman Gay
jacque at hyperactivesw.com
Tue Oct 23 01:43:42 EDT 2018
You shouldn't let your cat walk on the keyboard like that.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On October 22, 2018 9:40:09 PM Monte Goulding via use-livecode
<use-livecode at lists.runrev.com> wrote:
> Here’s one I have used which seems to work nicely:
>
>
> constant kURLRegex =
> "^(?:(?:(([^:\/#\?]+:)?(?:(?:\/\/)(?:(?:(?:([^:@\/#\?]+)(?:\:([^:@\/#\?]*))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((?:\/?(?:[^\/\?#]+\/+)*)(?:[^\?#]*)))?(\?[^#]+)?)(#.*)?"
>
> local tOrigin, tScheme, tUsername, tPassword, tHost, tNetloc, tPort,
> tPath, tParameters, tFragment
>
> if not matchText(pURL, kURLRegex, tOrigin, tScheme, tUsername, tPassword, \
> tHost, tNetloc, tPort, tPath, tParameters, tFragment) then
> throw format("could not parse url '%s'", pURL)
> end if
>
>
>> On 23 Oct 2018, at 1:07 pm, Tom Glod via use-livecode
>> <use-livecode at lists.runrev.com> wrote:
>>
>> Hi peeps,
>>
>> I'm trying to use regex to validate a list of URLs
>>
>> I've tried 4 or 5 different "regular" expressions that supposedly work
>> ..... but LC does not give me anything back. None of them work,
>>
>> Like for example ... this one.
>>
>> ^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$
>>
>> or this one
>>
>> /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
>>
>> or this one just to make sure
>>
>> (https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)
>>
>> Does anyone know how to get these or others to work in LC?
>>
>> Thanks,
>>
>> Tom
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list