1

I have a string like below.

#EXTINF:-1  tvg-id=ts191  tvg- 
logo=http://188.155.56.49/jumpstart/Temp_Live/cdn/HLS/Channel/imageContent-795-j5m7axrc- 
v1/imageContent-795-j5m7axrc-m1.png   group-title=Entertainment,   DD National
#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha 
#KODIPROP:inputstream.adaptive.license_key=https://tatasky.live.ott.irdeto.com/Widevine/getlicense?_session=y249xI2vioV2INEcjlJg4u7JC
https://delta12tatasky.akamaized.net/out/i/3569776.mpd

I'm looking for regex pattern to find link which is after licence_key link. I have tried below pattern but it's giving first link only.

(?<=#KODIPROP:inputstream.adaptive.license_key=).*

I just want https://delta12tatasky.akamaized.net/out/i/3569776.mpd as result.

Live copy available here Regexer Link to check.

1 Answer 1

2

You may use this regex for getting next line after a given fixed pattern:

#KODIPROP:inputstream\.adaptive\.license_key=.*\r?\n\K.+

RegEx Demo

If \K is not available in your regex flavour then use:

#KODIPROP:inputstream\.adaptive\.license_key=.*\r?\n(.+)

And use capture group #1 for your link.

RegEx Details:

  • #KODIPROP:inputstream\.adaptive\.license_key=: Match this prefix text literally
  • .*\r?\n: Match any text followed by line break
  • \K: Reset match info
  • .+: Match 1+ of any characters
Sign up to request clarification or add additional context in comments.

4 Comments

You are awesome @anubhava. It's perfect. Thank you so much.
@CarySwoveland: Indeed that was the intent. First regex should not have been capture groups (edited)
You still need a small adjustment in #2. :-)
Indeed you are right

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.