D
D
Dauren S2018-07-30 06:34:03
Regular Expressions
Dauren S, 2018-07-30 06:34:03

Regular expression to search for words in quotes?

"word" " word2 " "word3"
Is there a line like this, how to write a regular expression to extract all words in quotes?
, 3=>'word3');

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
DevMan, 2018-07-30
@dauren101

https://regex101.com/r/fx5t1t/1

I
Ilya, 2018-07-30
@Gorily

Option 1. We pull out everything that is in quotes of two types, even if there are several words with spaces and numbers:
https://regex101.com/r/LfzdAx/2
Option 2. Similarly, but the results do not need to be pulled out of groups:
https: //regex101.com/r/MhTPOB/1
(?<=["'])[^"']+

K
Kirill Nesmeyanov, 2018-07-30
@SerafimArts

Well, or here's "[^"\\]+(?:\\.[^"\\]*)*"an option if screening support via backlash is required.
https://regex101.com/r/d19vTs/1

N
Nick Sdk, 2018-07-30
@lidacriss

/(?<=['"])\w+(?=['"])/
https://regex101.com/r/pStvQo/1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question