Find and return the first matached regex in given string or FALSE otherwise

regex:find_one(STRING regex_pattern
, STRING subject) : STRING

$url = "http://noeun/this/that"

$url = regex:replace("~^http\:\/\/~i", "", $url);
#=> "www.sunsed.com/this/that"

regex:find_one("~^[a-z0-9-\.]{1,}~i", $url)
#=> "noeun"

regex:find("/^https{0,1}\:\/\/([a-z0-9\-\.]*)/i", "http://www.sunsed.com");
#=> [
#=>     "http://www.sunsed.com",
#=>     "www.sunsed.com"
#=> ]

regex:find_one('/i/','hi')
#=> "i"

Copyright ©2013-2022 SunSed®. All rights reserved.