-1

I have string Put a "string" between double quotes. I have regex ".*"

Why it matches only "string" and not "string" between double quotes ?

I see step by step execution of as:

  1. Regex part " means: find first " in string.
  2. Regex part .* means: find any symbols afterwards in any count.

I see that ".*" ends with ". But it is before .* and by logic everything after .* should just be ignored and every symbol should be matched ( .* stands for match any symbol any times). So can you please explain step by step execution of ".*" on Put a "string" between double quotes string?

vasili111
  • 5,040
  • 8
  • 40
  • 72
  • 2
    Any match for `".*"` has to begin with `"` and end with `"`. But `"string" between double quotes` doesn't end with `"`, so it doesn't match. – Nate Eldredge Apr 19 '20 at 02:04
  • Since regexes are handled differently in different languages, please update your question to reflect the language you are talking about. – WJS Apr 19 '20 at 02:08

1 Answers1

0

" > find all the quotation mark in your sentence

".* > give me everything (after the first quotation mark)

".*" > adding that mean until THE LAST quotation mark

Panda50
  • 816
  • 2
  • 5
  • 24