pharo-users@lists.pharo.org

Any question about pharo is welcome

View all threads

String to URL Validation

S
sean@clipperadams.com
Fri, May 19, 2023 2:12 PM

How would I test whether a string is a valid absolute URL? At first, I thought to attempt a conversion and catch the error, but then I realized that invalid URLs don’t always cause an error e.g. missing scheme and host return relative URLs with the entire string placed in the segments.

How would I test whether a string is a valid absolute URL? At first, I thought to attempt a conversion and catch the error, but then I realized that invalid URLs don’t always cause an error e.g. missing scheme and host return relative URLs with the entire string placed in the segments.