Apr 18th, 2010, 12:58 PM (This post was last modified: Apr 18th, 2010, 1:07 PM by bvdveen.)
(Apr 18th, 2010, 10:47 AM)Ben Wrote: Hi Bert,
Try double-escaping the commas.
Code:
rules.push("reg_exp,aantal_groen,^\s*(0|1|2|3|4|5|6|8|9|\\,\)\s*$,i,alleen cijfers en komma!");
I think that should fix it...
- Ben
Hi Ben!
Of course I immediately tried your solution....it fixed the error but didn't help ...when i put in a sequence of numbers and comma's it still gives the error
rules.push("reg_exp,aantal_groen,^\s*(0|1|2|3|4|5|6|8|9|\\,\)\s*$,i,alleen cijfers en komma!");
I think that should fix it...
- Ben
Hi Ben!
Of course I immediately tried your solution....it fixed the error but didn't help ...when i put in a sequence of numbers and comma's it still gives the error.
I want users to be able ti fill in any number with up to 4 digits or 3 digits with a comma as decinal separation.
would the following work?
rules.push("reg_exp,aantal_groen,^\s*(0|0\\,\25|0\\,\50\0\\,75|......)\s*$,i,alleen cijfers en komma!");
Quote:I want users to be able ti fill in any number with up to 4 digits or 3 digits with a comma as decinal separation.
Ah, okay! Hmm... try this instead:
Code:
rules.push("reg_exp,aantal_groen,^\s*[0-9\\,]{3,4}\s*$,i,alleen cijfers en komma!");
The "[0-9\\,]" bit is a "character class". It matches any number, 0-9 and the comma (double escaped to make it work within the string). The {3,4} bit matches the preceding expression either 3 or 4 times.
Quote:I want users to be able ti fill in any number with up to 4 digits or 3 digits with a comma as decinal separation.
Ah, okay! Hmm... try this instead:
Code:
rules.push("reg_exp,aantal_groen,^\s*[0-9\\,]{3,4}\s*$,i,alleen cijfers en komma!");
The "[0-9\\,]" bit is a "character class". It matches any number, 0-9 and the comma (double escaped to make it work within the string). The {3,4} bit matches the preceding expression either 3 or 4 times.
I think that'll work...
- Ben
Hello Ben,
I am sorry to say that it still doesn't work.
I want my users to be able to fill in numbers as:
1
2
2,24
0,01
when I try these options it still gives me my errormessage: alleen cijfers en komma....
Thanks anyway for reviewing my 'beginners' question.....
I hope you still somehow find the energy to try to resolve mu problem.
If not I will have to revert to make it a drop down box with 0 | 0,25 | 0,50| etc.. I have tried all options even against your advice to double escape the comma...no solution yet.
I would be very happy if you could help me with it. No time to follow a programmers course...;-)
Feel free to post as many times that you want to try out the implementation of the rule so far. I corrected the rule with a backslash after the \\, ....as you suggested before.
Greetings and thanks again ( I must be converting myself as the stone on your ankle)