I have a list of strings, for example:
set strLst = "file1 file2 file3 file4"
I want to log an error if some of the fields happen to begin with -, or have characters like ; : ' , ? ] { =
Which means for example setting
set ierr = 1
I have a list of strings, for example:
set strLst = "file1 file2 file3 file4"
I want to log an error if some of the fields happen to begin with -, or have characters like ; : ' , ? ] { =
Which means for example setting
set ierr = 1
for i in $strLst
> do
> tmp=`(echo $i | grep ^-) || (echo $i | grep "[; : ' , ? { = ]")`
> if [ "x$tmp" != "x" ]; then
> ierr=1
> fi
> done
Okay, I want to simplify on this.
I just want that the entries and alphanumeric.
Want to allow only the following
a-z,A-Z,numbers,spaces and -
---------- Post updated at 08:55 AM ---------- Previous update was at 08:46 AM ----------
I have created code like this
set errLst = ""
foreach f ($arg_browseFilesLst)
set cerr = `echo "$f" | grep "[ ; : ' , ? { } $ = ]"`
set cerr = `echo $f | awk '/^-|=/'`
if (${%cerr} > 0) then # Matches '-' at beginning or '='
set errLst = "$errLst $f"
set ierr = 1
endif
end
But I really am thinking of only allowing alphanumeric strings and punctuation characters, using
[:alnum:]
and
[:punct:]
[/CODE] and also not allowing - at the beginning of the string, and the = sign.