Regex for quoted string
/"(?:[^"\\]|\\.)*"/g
Matches
Examples
Note
Handles escaped quotes inside the string: a backslash and any character count as one unit.
Matches in the example
"\"hello\"""\"she said \\\"hi\\\"\""
Token by token
"the character “"”(?:a group, not capturing[^"\\]any character except “"” or the character “\”|or\\the character “\”.any character except a line break)*end of group, whole group zero or more times, as many as possible"the character “"”
Other patterns
- Email address
- URL
- IPv4 address
- UUID
- Hex color
- Date (YYYY-MM-DD)
- Time (24-hour)
- US phone number
- Phone number (E.164)
- US ZIP code
- Credit card number
- URL slug
- Username
- Strong password
- HTML tag
- Semantic version
- MAC address
- JSON Web Token
- Hashtag
- @mention
- Number
- Leading and trailing whitespace
- Repeated word
- Blank lines
- Markdown link
- Quoted string
- Domain name
- File extension
- Base64
- Trailing comma