Regular Expressions 101

Community Patterns

Is String having proper quotes around it

-1

Regular Expression
ECMAScript (JavaScript)

/
^("([^"]|\\")*?")$|^('([^']|\\')*?')$|^(`([^`]|\\`)*?`)$
/
gm

Description

  • Language : Javascript

  • Description : This will helpful for validating contents from a text editor where all the values are string and you need to verify that string must be a single string having quotes around it.

  • Note : This regex is best applicable by trimming the string before checking with this regex

Submitted by PranomVignesh<pranomvignesh@gmail.com> - 3 years ago (Last modified 3 years ago)