0

This is the content.

 <ext-link ext-link-type="uri" xlink:href="http://<xref&#x00A0;rid="x0026;AN=15230473">http://web.ebscohost.coms/ehost/detail&#x0026;#x003F;sid=d1f06770-cd74-4496-ae7b-7689ed05c6c4%40sessionmgr10&#x0026;#x0026;vid=1&#x0026;#x0026;hid=23&#x0026;#x0026;bdata=JnNpdGU9ZWhvc3QtbGl2ZQ%3d%3d&#x0026;#x0023;db=ufh&#x0026;#x0026;AN=15230473</xref>" link-type="url"> 

I want capture inside xlink:href="http://<xref&#x00A0;rid="x0026;AN=15230473">http://web.ebscohost.coms/ehost/detail&#x0026;#x003F;sid=d1f06770-cd74-4496-ae7b-7689ed05c6c4%40sessionmgr10&#x0026;#x0026;vid=1&#x0026;#x0026;hid=23&#x0026;#x0026;bdata=JnNpdGU9ZWhvc3QtbGl2ZQ%3d%3d&#x0026;#x0023;db=ufh&#x0026;#x0026;AN=15230473</xref>"

with double quotes.

I try this but cant get the which i need.

<ext-link(?: [^>]+)? xlink:href="([^"]+)"[^><]*> 
3
  • some other attribute also come after the xline:href Commented Nov 24, 2014 at 10:12
  • not found the solution. Commented Nov 24, 2014 at 10:13
  • @avinash i need upto the double quote from xlink:href="(upto end)" Commented Nov 24, 2014 at 10:18

3 Answers 3

1

Use \S+ to match one or more non-space characters.

<ext-link[^>]+? xlink:href="(\S+)" 

DEMO

Sign up to request clarification or add additional context in comments.

Comments

0
perl -pe 's/^.*xlink:href=\"//; s/\">$//' file 

Example:

sdlcb@Goofy-Gen:~/AMD/SO$ cat file <ext-link ext-link-type="uri" xlink:href="http://<xref&#x00A0;rid="x0026;AN=15230473">http://web.ebscohost.coms/ehost/detail&#x0026;#x003F;sid=d1f06770-cd74-4496-ae7b-7689ed05c6c4%40sessionmgr10&#x0026;#x0026;vid=1&#x0026;#x0026;hid=23&#x0026;#x0026;bdata=JnNpdGU9ZWhvc3QtbGl2ZQ%3d%3d&#x0026;#x0023;db=ufh&#x0026;#x0026;AN=15230473</xref>"> sdlcb@Goofy-Gen:~/AMD/SO$ perl -pe 's/^.*xlink:href=\"//; s/\">$//' file http://<xref&#x00A0;rid="x0026;AN=15230473">http://web.ebscohost.coms/ehost/detail&#x0026;#x003F;sid=d1f06770-cd74-4496-ae7b-7689ed05c6c4%40sessionmgr10&#x0026;#x0026;vid=1&#x0026;#x0026;hid=23&#x0026;#x0026;bdata=JnNpdGU9ZWhvc3QtbGl2ZQ%3d%3d&#x0026;#x0023;db=ufh&#x0026;#x0026;AN=15230473</xref> 

Comments

0
xlink:href=("(?:(?!<\/xref>).)*<\/xref>") 

Try this.grab the capture.See demo.

http://regex101.com/r/zU7dA5/6

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.