Answers for "regex for anything after character"

1

match all after regex

?(.*)
Posted by: Guest on April-30-2020
0

regex match everything before string

/.+?(?=abc)/
Posted by: Guest on August-04-2021
0

regex before and after character

const string = 'host_shopping.sql';
const regex = new RegExp('(?<=[_]).*(?=[.])');

let regArray = regex.exec(	string	);
console.log(	regArray[0]	);
 
// shopping

console.log(	string.test(regex)	);
//true

/*
-> regex before & after character.
-> with no group and can find at 0 index.
-> lookbehind and lookahead must be supported where to use.
 */
Posted by: Guest on October-06-2021

Code answers related to "regex for anything after character"

Browse Popular Code Answers by Language