user3423422
user3423422

Reputation: 23

Regex space in string

I want to get this code in regex but I am getting problem with the spaces between them so array doesn't show any thing because of spaces.

Example sting:

 dir="ltr"
        title="DRD Paratus-18 (Suit Case Gun)"
        data-sessionlink="ei=wpEsU4u8LZPI8gPK_YCwDQ&ved=CEYQvxs"

I want to get the title using Regex like

 DRD Paratus-18 (Suit Case Gun)

So the regex I am using is something like that so tell me what to do with that space after ltr" and what's the correct regex

dir="ltr"         "title="(.*?)"

Upvotes: 0

Views: 56

Answers (1)

Sabuj Hassan
Sabuj Hassan

Reputation: 39365

What is the " doing here??

dir="ltr"         "title="(.*?)"
             here^^

Correct one will be:

dir="ltr"\s+title="(.*?)"

Upvotes: 1

Related Questions