How to validate a column having website url value

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
k2g
Participant
Posts: 3
Joined: Sun Sep 02, 2012 12:03 pm
Location: Bangalore

How to validate a column having website url value

Post by k2g »

Hi,
In my source file, I have one column named as website_url. Before loading into target, I have to validate if it's value is proper website url or not.
For eg: It should start with www, http:// or https://. Also it should have valid domain. For eg: It should have formate like http://xxxx.xx.xx or other possible value. I am not able to cover all possible scenario and need help of you all expert. I am only 5 month old in Datastage. Your help will be much appreciated.

Thanks.
If at first you don't succeed, call it version 1.0
bob7027
Participant
Posts: 22
Joined: Wed Oct 03, 2012 2:49 pm
Location: United States

Post by bob7027 »

as per your validation, use index function to search for the string what you want, like HTTP or HTTPs.
and later search for the string in which format you are expecting it to be.
Check for conditions for your URL contains alpha numeric.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard.

If you are using version 8.7 or later and if you have Information Analyzer licensed then you can use the Data Rules stage to perform a matches_regex test on the URL. This is by far the easiest way to check URLs, as there are so many valid variants.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
k2g
Participant
Posts: 3
Joined: Sun Sep 02, 2012 12:03 pm
Location: Bangalore

Post by k2g »

Thanks Bob and ray for you reply.

Yes, I am checking this website_url column should not contain character like ! * ' ( ) ; : @ & = + $ , / ? % # [ ] . Apart from that, I am also checking that it should start with www, http:// or https://. I am not able to check the format of this website_url. For eg: If it's value is https://www.google.co.in , it is valid. But if it's value is https://www.googlecoin , it is not valid. Just wanted to know can we come up with common logic that we can implement in job to valid such things. Ray, As you mentioned, it can have many valid variant, that's why I am not able to come with common solution. I have to implement logic in job only, 8.1 Datastage.

Please help!

Thanks.
If at first you don't succeed, call it version 1.0
Post Reply