Link to home
Start Free TrialLog in
Avatar of fb1990
fb1990

asked on

Extract Specific Text

Can some please help me with a code snippet to extract specific text from a string Using T-SQL.  In the case of the strings below, I want to extract text between the '=' sign and '&' sign. Sometimes the '&hl=en' is missing from the combination

https://play.google.com/store/apps/details?id=com.barclays.android.barclaysmobilebanking&hl=en
https://play.google.com/store/apps/details?id=uk.co.hsbc.hsbcukmobilebanking
https://play.google.com/store/apps/details?id=org.coop.associatedschoolECU.coopmobile
https://play.google.com/store/apps/details?id=org.coop.associatedschoolECU.coopmobile&hl=en

Open in new window


Expected result
com.barclays.android.barclaysmobilebanking
uk.co.hsbc.hsbcukmobilebanking
org.coop.associatedschoolECU.coopmobile

Open in new window

Avatar of David Favor
David Favor
Flag of United States of America image

You asked an SQL related question, then provided URLs.

HTTP != SQL.

Provide your schema + SQL statements you've tried along with your results + likely someone can assist.
Avatar of fb1990
fb1990

ASKER

@david.  Thanks for looking at the problem.  Those are the values that I need to work on. I have tried this code snippet, it gets the &hl=en at the end of the url as well

SUBSTRING(STRING, CHARINDEX('=', STRING) + 1, LEN(STRING))

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mark Wills
Mark Wills
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fb1990

ASKER

Thank you so much, Mark.  It worked!
My pleasure :)