|
Hi all,
I have scenario where a string can contain '$' only at the start, I was able to create a regular expression for this validation, but now another scenario is the same string can be repeated by a ',' delimiter. Now what happens is since I don't allow the '$' in the string except for the first position, when I repeat the same string after ',' starting with '$' the validation fails.
Is there anyway in which we can restrict a character uptil some delimiter and then again allow it?
Any pointers would be appreciated.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
Explanation is not enough in all situations. So Please give some string examples..
Thank you..
Vinod Kumar B C
Software Engineer
|
|
|
|
|
Keep in mind that "$" is a special character, so you must escape it. The regular expression would look something like this:
^\$?((?!\$).)+(,\$?((?!\$).)+)*$
FYI, the tricky bit is called a "negative lookahead".
|
|
|
|