Regular Expressions 101

Community Patterns

Community Library Entry

-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> - 4 years ago (Last modified 4 years ago)