Leb i Sol Posted July 12, 2007 Share Posted July 12, 2007 Hello eveyone, I am trying to trim out the field that contains full urls into only domains. Eg. http://subdomain.domain.com/contact.html http://images.yahoo.com/userx/folder/image.jpg http://www.google.com/search?q=filemaker&rls=com.microsoft:en-us&ie=UTF-8&oe=UTF-8&startIndex=&startPage=1 into: http://subdomain.domain.com http://images.yahoo.com http://www.google.com so I found this works: Trim ( Substitute ( MiddleValues ( Substitute ( DestinationURL; ".com"; "¶"); DestinationURL; 1); "¶"; "" ) )&".com" ------------------------- ------------ but how to implement some form of variable to cover all domain extensions?(tv,org,edu,com,...) my poor logic would be: ------------------------------------- DomainVAR = .net .com .tv ....(all possible) Trim ( Substitute ( MiddleValues ( Substitute ( DestinationURL; "DomainVAR"; "¶"); DestinationURL; 1); "¶"; "" ) )&"DomainVAR" ------------------------------------- Or does this have to be scripted? Thanks for your time! Link to comment Share on other sites More sharing options...
sbg2 Posted July 12, 2007 Share Posted July 12, 2007 Left(MyURL; Position (MyURL ; "/" ; 1 ; 3 ) -1) Link to comment Share on other sites More sharing options...
Leb i Sol Posted July 12, 2007 Author Share Posted July 12, 2007 Thanks sbg2, I compleatly overlooked the pattern of "/" is always accounted 3 times. Thanks a bunch! Link to comment Share on other sites More sharing options...
Zero Tolerence Posted July 12, 2007 Share Posted July 12, 2007 what happens if there is no third slash? http://www.fmforums.com Do all fields have to be a longer url? Just curious here. Link to comment Share on other sites More sharing options...
comment Posted July 12, 2007 Share Posted July 12, 2007 How about: Let ( text = MyURL & "/" ; Left ( text ; Position ( text ; "/" ; 1 ; 3 ) - 1 ) ) Link to comment Share on other sites More sharing options...
Leb i Sol Posted July 19, 2007 Author Share Posted July 19, 2007 Thanks Zero Tolerence for pointing this out. Comment, thanks for the final touch! Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 6118 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now