baanfans
9th January 2009, 16:28
Hello!
I need validate data to report, in order to only allow character values into A-Z, a-z & numbers from 0-9, without any others specials characters.
How can i do that?
Thanks in advance!
_Ralph_
9th January 2009, 18:05
Take a search on this forum for "Advanced String Manipulations" there many threads with the answer.
NirajKakodkar
11th January 2009, 15:53
I need validate data to report, in order to only allow character values into A-Z, a-z & numbers from 0-9, without any others specials characters.
Hi ,
If I understood what is your requirement properly , I think you should
use Ascii values of the characters .
For example , you need A-Z , a-z and 0-9
if (asc(i.char) >= 65 and asc(i.char) <=90) and
(asc(i.char) >= 97 and asc(i.char) <=122) and
(asc(i.char) >= 48 and asc(i.char) <=57) then
........................
.....................
endif
Regards,
Niraj
rahul.kolhe22
12th January 2009, 08:00
Hi,
See the code below. I think even this option will work. Here only once we have to compile the expression using expr.compile, then later on just use it to validate the data. Function l.expr will return value "0" if the string contains illegal characters.
I think that it can improve the performance, please rectify if I am wrong because I am not very much sure about it.
long expr.id, ret
expr.id = expr.compile("$$ in ""^[0-9A-Za-z]*$""")
ret = l.expr(expr.id, "hjg56573xcbvGGU")
expr.free(expr.id)
Even please rectify if the above code is incorrect. I have tested it before posting the reply, but still if any suggestions please go ahead.
Regards,
-Rahul
Hitesh Shah
12th January 2009, 14:29
Also u may use the domain (like tigrt.dept ) which has similar range validation like $$ in "^[A-Za-z0-9 ].*$" .
rahul.kolhe22
12th January 2009, 15:03
Hello Hitesh Shah,
I saw the range expression for the domain "tigrt.dept", it was
$$ in "^[A-Za-z0-9. ]* *$"
I am unable to understand
$$ in "^[A-Za-z0-9. ]* *$" the part of the expresion marked in red.
I am able to understand that "*$" will consider all the characters till end of the string, but "* *$" I am unable to understand.
Thanks in advance
-Rahul
baanfans
12th January 2009, 18:12
Hello all, thanks by your answers!!
Finally, I wrote that:
if digit >= "A" and digit <= "Z" or
digit >= "a" and digit <= "z" or
digit >= "0" and digit <= "9" then...
...
endif
and it works fine!
Thanks all!
Hitesh Shah
12th January 2009, 20:19
Hello Hitesh Shah,
I saw the range expression for the domain "tigrt.dept", it was
$$ in "^[A-Za-z0-9. ]* *$"
I am unable to understand
$$ in "^[A-Za-z0-9. ]* *$" the part of the expresion marked in red.
I am able to understand that "*$" will consider all the characters till end of the string, but "* *$" I am unable to understand.
Thanks in advance
-Rahul
That domain must be starting with these values but in trailing characters spaces are valid. This will give consistent results for values lessthan 8 characters .
The suggestion is that one can also use any existing domain if any or create one with similar validation and the same field length .