> > Maybe the documentation needs a tweak.
Will do... Sean On Tue, 23 Oct 2018 at 15:04, Tom Glod via use-livecode < use-livecode@lists.runrev.com> wrote: > <SOLVED> > > I originally used > > filter the lines of my_container with myregex > > or filter my_container with myregex > > none of the expressions worked..... just blanked out. > > When I used the same form as Steve...it worked. > > filter my_container with regex pattern myregex into my_variable > > So is that a bug in the filter command? literally lost hours on this. > > > > Thank you all ..... onto some working code. :) > > > On Tue, Oct 23, 2018 at 9:27 AM Stephen MacLean via use-livecode < > use-livecode@lists.runrev.com> wrote: > > > Hi Tom, > > > > Don’t know if you found a solution yet, but this is from the rsIsValid > > suite I put together a few years back. > > > > http://forums.livecode.com/viewtopic.php?f=16&t=26653&p=138698#p138698 < > > http://forums.livecode.com/viewtopic.php?f=16&t=26653&p=138698#p138698>. > > https://github.com/renegadesteve/rsIsValid < > > https://github.com/renegadesteve/rsIsValid> > > > > > > Below is the LCS version: > > function rsIsValidURL pURL > > > > put pURL into tCC > > > > // get scheme > > > > put "^(?<scheme>[a-z][a-z0-9+\-.]*):" into tSchemeRegex > > > > get matchText(tCC, tSchemeRegex,tScheme) > > > > // check scheme for http, https, ftp, ftps, mailto, nntp, news, or file > > > > if it <> true then return false > > > > if tScheme = "mailto" then > > > > //get the email address from the URL and then validate it > > > > delete char 1 to 7 of tCC > > > > return rsIsValidEmail_LC(tCC) > > > > else > > > > // setup the regex pattern > > > > put "^(?:http://|https://|ftp:// > |ftps://|nntp://|news://)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]-*)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?$" > > into tURLRegex > > > > // run filter against regex pattern and set result to true if it matches. > > > > filter tCC with regex pattern tURLRegex into tMatch > > > > if tMatch <> empty then > > > > return true > > > > else > > > > return false > > > > end if > > > > end if > > > > end rsIsValidURL > > > > > > Best, > > > > Steve MacLean > > > > > On Oct 22, 2018, at 10:07 PM, Tom Glod via use-livecode < > > use-livecode@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@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@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@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@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode