Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to remove quotes using regex

var str = 'remove "foo" delimiting double quotes';
console.log(str.replace(/"([^"]+(?="))"/g, '$1'));
//logs remove foo delimiting quotes
str = 'remove only "foo" delimiting "';//note trailing " at the end
console.log(str.replace(/"([^"]+(?="))"/g, '$1'));
//logs remove only foo delimiting "<-- trailing double quote is not removed
Comment

how to remove quotes using regex

var someStr = 'He said "Hello, my name is Foo"';
console.log(someStr.replace(/['"]+/g, ''));
Comment

how to remove quotes using regex

str.replace(/^["'](.+(?=["']$))["']$/, '$1');
Comment

how to remove quotes using regex

someStr.replace(/^"(.+)"$/,'$1');
Comment

how to remove quotes using regex

str.replace(/^"(.+(?="$))"$/, '$1');
Comment

how to remove quotes using regex

if (str.charAt(0) === '"' && str.charAt(str.length -1) === '"')
{
    console.log(str.substr(1,str.length -2));
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: search datatable vuetify 
Javascript :: generate random string with javascript 
Javascript :: base64 to image nodejs 
Javascript :: replace jquery 
Javascript :: Node Sass version 7.0.0 is incompatible with ^4.0.0 
Javascript :: http request javascript 
Javascript :: react native safeareaview 
Javascript :: move first element to last javascript 
Javascript :: hash object javascript 
Javascript :: winston logger creating particular log file for each level 
Javascript :: js read file json 
Javascript :: react-native-config 
Javascript :: 2d array filter repetition in javascript 
Javascript :: how can i convert object to an array javascript 
Javascript :: react native vector icons not working 
Javascript :: es6 convert array to object 
Javascript :: strpos in javascript 
Javascript :: safeAreaProvider 
Javascript :: generate random color array javascript 
Javascript :: How to print somethign to the console with javascript 
Javascript :: append line break javascript 
Javascript :: javascript reverse 
Javascript :: express minify html 
Javascript :: read multiple parameters in url in js 
Javascript :: come andare a capo su javascript 
Javascript :: get random element from string array java 
Javascript :: prime numbers using for loop in Js 
Javascript :: midpoint formula javascript 
Javascript :: import svg as react component 
Javascript :: not disabled jquery 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =