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 :: javascript string first letter lowercase 
Javascript :: js array to comma separated list 
Javascript :: javascript download json 
Javascript :: jest test array of objects 
Javascript :: remove disable attr jquery 
Javascript :: how to find text in jquery with find function 
Javascript :: modify root in javascript 
Javascript :: once content is loaded run function 
Javascript :: js promise all return json array 
Javascript :: stop settimeout 
Javascript :: how to get name array value checked in jquery 
Javascript :: express js basic example 
Javascript :: classname toggle js 
Javascript :: get all values of a select javascrip 
Javascript :: send a message to a specific channel discord.js 
Javascript :: javascript keywords 
Javascript :: jqeury cdn 
Javascript :: tabe close alert in js 
Javascript :: bright green in javascript 
Javascript :: expo create react native app 
Javascript :: javascript print numbers in the given range 
Javascript :: regex password validation 
Javascript :: allow only integer or float in text fields jQuery 
Javascript :: trigger on change 
Javascript :: javascript current time 
Javascript :: convert array to json in js 
Javascript :: when I pass a variable as a function parameter, is a new copy of the variable value or a memory reference javascript 
Javascript :: js touchmove get client position 
Javascript :: on modal close jquery 
Javascript :: button click javascript 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =