11-15-2011 04:50 AM
How to check for an alphanumeric string using Regexp function?
11-15-2011 05:03 AM - edited 11-15-2011 05:04 AM
11-15-2011 05:40 AM - edited 11-15-2011 05:44 AM
Thanks a lot. But the above VI fails if i give underscore or empty space so we should add condition for it i guess.
I also got it in a similar way . I am trying without using regexp , by using ASCII . Is there any way of achieving it , suppose i give a single character and it should check for alphanum.
I have also enclosed in my VI for conversion and checking for alphanum string.
11-15-2011 06:08 AM - edited 11-15-2011 06:15 AM
Why do you want to avoid using regular expressions? Unless you're using this in a loop that needs to go very fast, a regexp is fine (and much cooler).
Sorry about forgetting the underscore; how's this? The "pipe" is an OR operator. This regexp looks for anything that's not a word character (letters, digits and underscores) and then looks for an underscore. If it finds either, the input string is not alphanumeric.
11-15-2011 08:22 AM
11-15-2011 08:29 AM
@ben64 wrote:
[...]
NOTE: The pipe and underscope should be included in the character class, the correct regex is [^\w|_]
That won't work. My regexp is looking for anything that's not a word character or IS an underscore. Yours looks for anything that's not a word character or an underscore, which is redundant and misses the underscore.
11-15-2011 08:34 AM
11-15-2011 09:30 AM
11-15-2011 11:34 AM
"Any technology sofisticated enough is indistinguishable from magic."
Regexp is magic.
/Y
11-15-2011 11:43 AM
of course there is the Lexical class function on the comparision palatte to do all the regexs for you!
Hmmmmm This round thing is neat--- I should call it a "Wheel"