I need a javascript function which gets a string and returns false if the string contains
- Any unclosed dollar symbol
- Or a closed dollar symbol with something between dollars different than a series of characters
function validateFormat(text) {
// Do stuff
}
For example if text:
validateFormat("blab abalaba $something$ avava $affo$") -> true
validateFormat("blab abalaba $something$ avava $ affo$") -> false because of the white space
validateFormat("blab abalaba $1so3mething$ avava $affo$") -> false because of the numbers
validateFormat("blab abalaba $something") -> false because of unclosed placeholder
Can someone help me?