IvRRimUm
IvRRimUm

Reputation: 1834

If line contains a word then return text between characters "

If line contains a word then return text between characters "

<a href="index.php?sheet=2362327&sign=1" alt='This is funny alt' class='some test classes'>

I need to get url index.php?sheet=2362327&sign=1 if sign= is found.

P.S

I have found a way to get a line if word is found: /^.*\bsign=\b.*$/m

And to get content between 2 characters: (?<=")(.*)(?=")

Upvotes: 1

Views: 59

Answers (1)

vks
vks

Reputation: 67968

(?<=")[^"]*\bsign=\b[^"]*(?=")

You can just club the two to get your result.

Upvotes: 1

Related Questions