I want regex get string without dash ?? any help??
for example
gamal-hany
gamal hany
I want regex retrieve first one(gamal-hany)
I want regex get string without dash ?? any help??
for example
gamal-hany
gamal hany
I want regex retrieve first one(gamal-hany)
If you want to match some characters followed by a minus follwed by some characters, try this:
/^.+\\-.+$/
console.log("gamal-hany".match(/^.+\\-.+$/));
["gamal-hany", index: 0, input: "gamal-hany"]
console.log("gamal hany".match(/^.+\\-.+$/));
null
HTH