Relative Content

Tag Archive for javascriptregex

Javascript Regular Expression Not Failing When I Think It Should [duplicate]

This question already has answers here: Regex – Should hyphens be escaped? [duplicate] (3 answers) Closed 16 days ago. My code: let g_Check = /^[a-z]+[a-z -.]{0,25}$/i; let bl = g_Check.test(“abc*”de”); // returns true, when I think it should return false because of the ‘*’ and ‘”‘ As you can see it returns true, when I […]

regex for comma followed by space or just comma

is it possible to make a regex with multiple delimiters? For example I want to split a string which can come in two forms: 1. “string1, string2, string3” or 2. “string1,string2,string3”. I’ve been trying to do this in javascript but with no success so far.