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 :: js get object properties 
Javascript :: Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". 
Javascript :: hide a div when user clicks outside of it 
Javascript :: javascript sum array of objects by key 
Javascript :: two decimel javascript 
Javascript :: knex.js count 
Javascript :: jquery remove focus 
Javascript :: how to define args using param discord.js 
Javascript :: yarn build react 
Javascript :: javascript store text file into string 
Javascript :: adb bootloader reboot 
Javascript :: How to calc() height in react native for styling 
Javascript :: javascript foreach index 
Javascript :: gcloud storage cors 
Javascript :: lodash remove undefined values from object 
Javascript :: console table js 
Javascript :: javascript sum array 
Javascript :: how to upload file in material ui 
Javascript :: strapi production build 
Javascript :: moment js react 
Javascript :: js input hidden get value 
Javascript :: how to get innerhtml value in javascript 
Javascript :: performance.now() javascript 
Javascript :: regular expression javascript password strength 
Javascript :: how to check if a number is a whole number in javascript 
Javascript :: javascript get intersection of two arrays 
Javascript :: javascript date time formating 
Javascript :: javascript sort array smallest to largest 
Javascript :: jquery array remove element 
Javascript :: get value of hidden field jquery 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =