Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript get string between two characters

const oldString = 'John1Doe2'

const stringBetweenCharacters = oldString.match(/1(.*?)2/i)[1] //Doe
Comment

js substring between two characters


let str = "My string is:abc;";

var mySubString = str.substring(
    str.indexOf(":") + 1, 
    str.lastIndexOf(";")
);

// mySubString = "abc"
Comment

Get Substring between two characters using javascript

let mySubString = str.substring(
    str.indexOf(":") + 1,   // from character ':'
    str.lastIndexOf(";")	// to character ';'
);
Comment

javascript find string between two characters

var str = 'one:two;three';    
str.split(':').pop().split(';')[0]; // returns 'two'
Comment

PREVIOUS NEXT
Code Example
Javascript :: round to nearest hundredth javascript 
Javascript :: jquery redirect to url 
Javascript :: window.ReactNativeWebView.postMessage 
Javascript :: foreach element in class javascript 
Javascript :: javascript reserved words 
Javascript :: javascript change image src 
Javascript :: asyncstorage.getallkeys 
Javascript :: random color code javascript 
Javascript :: js round to nearest thousand 
Javascript :: es6 
Javascript :: how to detect a button click in javascript 
Javascript :: nativescript vue get native from ref 
Javascript :: filter using two array of objects 
Javascript :: fs.writefile 
Javascript :: truncate function react 
Javascript :: react router dom npm 
Javascript :: take only int part of number js 
Javascript :: javascript remove multiple items from array 
Javascript :: console.log regex 
Javascript :: mysql get json value by key 
Javascript :: jquery bind function to multiple events 
Javascript :: js create events in for always gets last id 
Javascript :: js clean nested undefined props 
Javascript :: mongodb instruction 
Javascript :: jsx emmet vscode 
Javascript :: javascript iterate over object 
Javascript :: how to clone a object in javascript angular 
Javascript :: set nested state react hooks spread operator 
Javascript :: Introdução ao nodeJs 
Javascript :: date of birth validation in yup 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =