Apr 13, 2020 13:01
bus time nahi lagta
Apr 13, 2020 13:00
Idhar hi hun
Apr 12, 2020 04:25
@ShobhakarTiwari
Apr 12, 2020 04:22
Kya haal chaal
Apr 12, 2020 04:22
Good morning
Apr 11, 2020 08:29
@ShobhakarTiwari Hi
Apr 2, 2020 10:25
How you doing?
Apr 2, 2020 10:25
Good @ShobhakarTiwari
Apr 1, 2020 13:31
Hi
 

Android

Don't say hi. Don't ask questions. Don't have fun. Don't do an...
Apr 1, 2020 13:31
Thanks
Apr 1, 2020 13:30
@RaghavSood I'm not new to this site. And not asking for any link doc or code.
Apr 1, 2020 13:24
Anyone implemented the pay with paypal using braintree vault recently ?
Apr 1, 2020 13:24
Thanks
 

[iOS][Android][ChaosOverFlow]

Join to become part of the community, not to simply ask questi...
Apr 1, 2020 13:25
Hi
 
Jul 26, 2019 12:02
I posted it as an answer
Jul 26, 2019 11:43
I know, I'm just telling ;)
Jul 26, 2019 11:41
100% regex is not possible to validate the email and url
Jul 26, 2019 11:40
Not sure if you required more cases or thats enough
Jul 26, 2019 11:39
**Output**

true
true
true
true
true
false
false
Jul 26, 2019 11:39
print("http://stackoverflow.com".isValidUrl())
print("stackoverflow.com".isValidUrl())
print("ftp://127.0.0.1".isValidUrl())
print("www.google.com".isValidUrl())
print("127.0.0.1".isValidUrl())
print("127".isValidUrl())
print("hello".isValidUrl())
Jul 26, 2019 11:39
I modified the regex
Jul 26, 2019 11:39
extension String {
func isValidUrl() -> Bool {
let regex = "((http|https|ftp)://)?((\\w)*|([0-9]*)|([-|_])*)+([\\.|/]((\\w)*|([0-9]*)|([-|_])*))+"
let predicate = NSPredicate(format: "SELF MATCHES %@", regex)
return predicate.evaluate(with: self)
}
}
Jul 26, 2019 11:39
hmm
Jul 26, 2019 11:17
^(https?://)?(www\\.)?([-a-z0-9]{1,63}\\.)*?[a-z0-9][-a-z0-9]{0,61}[a-z0-9]\\.[a-z]{2,6}(/[-\\w@\\+\\.~#\\?&/=%]*)?$

Please try by removing https and www from here .. this is your regex.

([-a-z0-9]{1,63}\\.)*?[a-z0-9][-a-z0-9]{0,61}[a-z0-9]\\.[a-z]{2,6}(/[-\\w@\\+\\.~#\\?&/=%]*)?$
Jul 26, 2019 11:16
Okay I will check
Jul 26, 2019 11:14
there might be some difference for iOS platform
Jul 26, 2019 11:13
I tested it on regextester.com/94502 site
Jul 26, 2019 11:09
Otherwise it is wrong
Jul 26, 2019 11:09
If you have static data and limited to only two schemes then you can use above condition
Jul 26, 2019 11:08
and it will make mailto://[email protected] to http://mailto://[email protected]
Jul 26, 2019 11:04
If it's not possible to add an empty scheme, that's fine and I'll just continue adding a "http://" to an URL/IP if there isn't one, then test it with canOpenURL.
Jul 26, 2019 11:02
@Neph I'm quoting this
Jul 26, 2019 11:00
I'm wonder how will you do that?
Jul 26, 2019 11:00
Yes, Not possible to add valid scheme.
Jul 26, 2019 10:59
Because no one knows which scheme is valid for which url
Jul 26, 2019 10:59
If you just want to validate the URL without scheme then I have shared the regex
Jul 26, 2019 10:58
If you want to add a valid scheme to the URL then this is not possible
Jul 26, 2019 10:57
Just try with that regex. It should work for you.
Jul 26, 2019 10:56
But logically without a scheme URL is not valid. It just a string.
Jul 26, 2019 10:55
Did you try with regex I mentioned in comment?
Jul 26, 2019 10:54
You just need to remove the regex for scheme
Jul 26, 2019 10:54
The regex you mentioned in the comment box is using schemes as prefix
Jul 26, 2019 10:54
May be
Jul 26, 2019 10:52
Hi Neph
Jul 26, 2019 10:47
@Neph Then you need to validate URL with regex not with if it can be open or not. Like for email we check if its valid or not but not if its reachable or not.
Jul 26, 2019 10:47
[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$ I found this regex for you which validates like this.
Jul 26, 2019 10:47
@Neph Suppose http://190.128.0.1 exists and ftp://190.128.0.1 doesn't. In that case is 190.128.0.1 valid or invalid ?
Jul 26, 2019 10:47
See the huge list of URL Schemes so you can't just guess the valid one.
Jul 26, 2019 10:47
Why don't you append the scheme if not exists in the URL ?
 
Jul 17, 2019 10:15
Tutorial will help